-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide proper EuclideanClusterComparator method depreciation. New Pragma macro. New Deprecated type. #2096
Provide proper EuclideanClusterComparator method depreciation. New Pragma macro. New Deprecated type. #2096
Conversation
- Restored the previous ECC API - Defined a "protected" base class which will replace the original in a future release.
5db45b0
to
3f91a88
Compare
I'm not sold by the Other random comments:
|
👍
Fair enough. Although I just did it like that because I can't seem find a way to deprecate a template parameter, because the entire class is not gonna be deprecated. Normally, upon deprecation there's a transient period in which the old definition and the new one coexist and you tell people to migrate. In our case we still want to preserve the class name and that is messing up the process.
Something which didn't break the ABI/API but in which the class behavior/output changed compared to before. Originally it was to signal that we are no longer using normals in the clustering process. In this particular PR it was misused, because I'm only adding the old interface. |
But even the original PR did not change behavior, because normals and angular threshold were not used at all? Or did I misunderstand something? |
That's right. The class had normals as class members but did nothing with them. |
By the way, I think I have figured out a way to deprecate template parameter. Will post a proof-of-concept soon. |
Awesome! Should we delete the macros I added or shall we leave them? |
Wait, maybe you won't like my solution :) |
Here we go: http://cpp.sh/2pyit |
Oh that looks cool. I actually thought that would be considered a redefinition of A but not. That way it's still two different classes but now with the "same name" just different amount of templates. |
I had another look at this and your approach definitely improved mine but the point regarding the documentation is still present.
With variadic templates we would have cleaner options 😞 http://cpp.sh/9ef2s |
AFAIK Doxygen has some markers or macros to exclude certain classes or functions from documentation...
And yeah, modern C++ solution looks way better!
|
I adopted the strategy you devised. I added 2 (!) inner namespaces to pcl namespace: experimental, deprecated.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your solution 👍
One small thing. I'd propose better deprecation warnings, see comments.
|
||
/** \brief Empty constructor for EuclideanClusterComparator. */ | ||
PCL_DEPRECATED ("EuclideanClusterComparator will no longer be templated on a PointNormal type in future minor release") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Remove PointNT
from template parameters."
distance_threshold_ = distance_threshold; | ||
depth_dependent_ = depth_dependent; | ||
} | ||
PCL_DEPRECATED ("EuclideanClusterComparator no longer makes use of normals.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it never used normals in the first place. I think it can be useful to let the users know this. Otherwise the line of thinking when someone sees this message is: "Oh crap, what should I do now? I still need to compare normals. Is there another class now? Which one, how to find it?"
So perhaps a better deprecation message would be something along these lines: "EuclideadClusterComparator never actually used normals and angular threshold, this function has no effect on the behavior of the comparator. Therefore it is deprecated and will be removed in future releases."
Same for other functions.
Will do. There's one thing which worries me though. I'm not seeing deprecation warnings popping up in the build and I'm quite sure I should seem them, because there's code using the three template parameter signature. |
Oh right, speaking of which... Since we already support the future two-parameter signature, there is no need to bring back normals to the library sources.
Hm, indeed. I went through your changes again and they implement the proof-of-concept exactly, don't see any difference. |
I'm looking into it. I left originally the three template signature exactly to confirm the verbose, with the intention to remove after. |
They're popping on my system for gcc but not for clang. Since the apps task is clang built we get no warnings. |
On my machine clang3.8 reports warnings for my PoC. |
|
It was only introduced in http://releases.llvm.org/3.9.0/tools/clang/docs/AttributeReference.html#deprecated-gnu-deprecated so everything should be ok. I'll proceed with the removing the template parameters from our code and it should be good to go. |
Oh... so you say it should actually work in 3.8 as well... hmm... |
Interesting. We have the same environment $ clang++ --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin and I do get warnings warning: 'A' is deprecated: Second template parameter is
deprecated, remove it [-Wdeprecated-declarations] |
Also, on Travis we have 3.9.0 which definitely has this attribute according to the link you posted. |
Some interesting findings:
We're messing up some flags for sure. The compiler flags in each case
That -Wno-deprecated looks suspicious |
I guess with clang we fall under this branch: Line 122 in cd302dc
Not sure how it gets propagated to a project using PCL. |
It’s not sure it is that. I commented that line before and I’m still getting the flag.
… On 26 Nov 2017, at 15:23, Sergey Alexandrov ***@***.***> wrote:
I guess with clang we fall under this branch:
https://github.com/PointCloudLibrary/pcl/blob/cd302dc8b6bc779c3fb279f2b18fe411631dff26/CMakeLists.txt#L122
Not sure how it gets propagated to a project using PCL.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
It gets added when we request the visualization component in find package. |
The issue comes from here pcl/visualization/CMakeLists.txt Line 12 in 5d18757
Which is adding this vtk use file. This is provided from the vtk package and in my system this looks like this vtk-5.10 #
# This module is provided as VTK_USE_FILE by VTKConfig.cmake. It can
# be INCLUDEd in a project to load the needed compiler and linker
# settings to use VTK.
#
IF(NOT VTK_USE_FILE_INCLUDED)
SET(VTK_USE_FILE_INCLUDED 1)
# Update CMAKE_MODULE_PATH so includes work.
SET (CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${VTK_CMAKE_DIR})
# Load the compiler settings used for VTK.
IF(VTK_BUILD_SETTINGS_FILE AND NOT SKIP_VTK_BUILD_SETTINGS_FILE)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeImportBuildSettings.cmake)
CMAKE_IMPORT_BUILD_SETTINGS(${VTK_BUILD_SETTINGS_FILE})
ENDIF(VTK_BUILD_SETTINGS_FILE AND NOT SKIP_VTK_BUILD_SETTINGS_FILE)
# Add compiler flags needed to use VTK.
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${VTK_REQUIRED_EXE_LINKER_FLAGS}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${VTK_REQUIRED_SHARED_LINKER_FLAGS}")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${VTK_REQUIRED_MODULE_LINKER_FLAGS}")
# Add include directories needed to use VTK.
INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS})
# Import the VTK_LOAD_CMAKE_EXTENSIONS macro.
INCLUDE(vtkMakeInstantiator)
ENDIF(NOT VTK_USE_FILE_INCLUDED) The contents of VTK_REQUIRED_CXX_FLAGS include the -Wno-deprecate
|
What to do in this scenario? This is an upstream compilation option of whom packaged vtk5 for apt. I was now experimenting with not using that VTKUse file but I'm not fully sure this is the way to address this. |
I suspected VTK and even grepped for "no-deprecated" in |
I would conjecture that VTK 6 and above do not set this flag. As for VTK 5... well, bad luck, what can we do. |
Yet to be explained is why it pops only on clang. |
3bff000
to
c3f4710
Compare
Just pushed the final things. I can't perform any more reorganizing of commits easily due to the indentation changes. |
Thanks! |
Here's something for us to discuss: in order allow us saving time cleaning things in the future, I created an intermediate class (which can't be directly instantiated), and implements what's gonna be the final functionality of the ECC. It will just suffer a rename later on.
I replaced the map for a set as pointed out before.
Closes #2091