-
-
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
Deprecate pcl/make_shared.h
header; extract PCL_MAKE_ALIGNED_OPERATOR_NEW
into pcl/memory.h
#3654
Deprecate pcl/make_shared.h
header; extract PCL_MAKE_ALIGNED_OPERATOR_NEW
into pcl/memory.h
#3654
Conversation
PTAL at my change a4e46e7 where I've moved around a different (and smaller) set of includes. |
@kunaltyagi so you're saying std -> library -> 3rd party instead of library -> std -> 3rd party? I remember arguments in favor of both, and I see different approaches in PCL's files' convention (if there is one). |
I had the impression that we want to have "library -> 3rd party -> std", but this was not codified yet. |
The order is not the concern. The files used is one. I move Eigen/Core and you move a lot more (indirectly included via pcl_macro). As for the order, both have pro and cons. I don't really mind changing the order. The reason I prefer std first is because I trust the files on top to not include/declare anything that might cause a problem for later includes. So my personal order is std->3rd_party->library in a decreasing order of trust. lib first approach allows for dependency check at a glance which is also nice. |
This. To catch issues with potential transitive dependencies early on. |
660a2c4
to
ffaa159
Compare
I tried, it works here, let me see what CI says. EDIT: there was an extra rename for pcl_macros.h -> eigen_base.h in point_types.hpp |
ffaa159
to
68c0453
Compare
#undef Success
in pcl_macros by changing include order in VTK header#undef Success
in pcl_macros.h by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into eigen_base.h
Formatting is locally fixed (includes in alphabetic order), tutorials are locally fixed (forgot to add the new header in CMakeLists.txt), but Build.Ubuntu-16.04 fails for a PCL_EXPORTS error:
which I don't understand. The error is for forward declarations which require full types, but pcl_exports.h is about NVCC. I'm thinking eigen_base.h is lacking a way to avoid NVCC like pcl_macros.h used to due to Eigen/Core, but don't know what or where yet. EDIT: it's a transitive dependency issue on PCL_EXPORTS, let me retest |
We can remove pcl_exports now that pcl_macros is about to be nvcc compatible (Not now now; soon: post deprecated PR merge #3634) with the removal of Eigen/Core. As for the error, it seems like PCL_EXPORTS is not found (since the compiler assumes it is in simulation namespace). You might need to include pcl_macros wherever the relevant macros are used. |
I can build pcl_simulation, there was also a missing couple of |
68c0453
to
129235f
Compare
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'm not sure if global replace of pcl_macros.h
with eigen_base.h
is reasonable. That file provided a bit more than PCL_MAKE_ALIGNED_ALLOCATOR_NEW
and we need to check at every include site what actually was used.
Also, sorry for the delay, I'd like to do a bit of name bikeshedding. What do you think about eigen.h
instead of eigen_base.h
? It's more common throughout PCL to have headers named after third-party libraries, without suffixes.
Not opposed. But it'd require renaming the existing
It's not. At the very minimum all files without pcl_macros but with eigen_base and PCL_EXPORT will need pcl_macros. |
I have a feeling we are going to make some hastily moves now for no good reason and break something. Let's limit this PR to removing undefs and fixing the order of includes in VTK header. Reorganization of |
As Kunal points out (and I did too, here) there are already files named eigen.h in io, common, surface, features, geometry, registration, visualization, sample consensus and in (one of the) apps.
Eh, agreed, seems to me like ~130 files are a tad too many to check by hand. Unless IWYU can handle it all? Then I add the new header instead of replacing pcl_macros, so it's at most a useless include which was already present and IWYU would/should remove it with a pass. I can commit that and maybe Kunal could try a pass on the PR with it to check? EDIT:
RE: global replace: it's actually replacing only the includes in the files with the custom allocation macro, to be clear. Still like this the scope is unrealistic, some pcl macro is bound to be needed by at least some of those files. EDIT2: |
d46cba9
to
010bb14
Compare
The errors don't seem related to the PR:
|
Mine too (Don't know if I should cry or be happy about this) |
OK, the taken "global replace" approach seems solid to me and I'm not afraid that something is going to break. However, and please forgive me for being stubborn, I do not understand the motivation behind:
|
IMO, pcl_macros is a bad example of a filename. There are several kinds of macros and each brings with it a different header baggage. There are mainly 4 kinds of macros in PCL
Clearly, the last 2 types have been segregated by origin, use and functionality. The filename isn't a good argument for putting all macros everywhere in one file. Macros are just like functions. There's no harm in creating one file for a function if it doesn't fit in with 10 functions with a similar input arguments but different functionality. |
While there would be no harm in doing this per se (some go so far as to advocate for one function per file to avoid including unnecessary headers, even...a bit too much for me), my intention was to predispose a file to separate this macro together with the ones in point_types.hpp which were previously included. Doing so in two separate PRs allows a more granular check for breakage (as you say yourself, this micro-move I've made made you "not afraid that something is going to break", which was a concern for me as well with how the PR was set up 2 days ago). If you think the PCL_MAKE_EIGEN_TYPES_WORK macros should be bundled together (e.g. to include Eigen/Core only there, but also to group logically similar macros together) then it's just a matter of choosing a fitting name for the header, which brings me to
None really, maybe eigen_support.h, eigen_types.h (we use the macro to define an allocator trait, and the eigen vector maps are types too), or anything else that works better. My point in pushing with eigen_base.h was to at least confirm nothing breaks and the methodology is sound. It doesn't take much to change the name once one is decided. This PR is still a draft, if you will. Moreover anybody that uses IWYU can already check the modified headers, where they might find some |
This PR started like a simple fix (move the include up, remove undefs) and in a blink of an eye spiraled into a massive changeset with over 100 files touched. On top of that, there is a parallel PR by Kunal. I was overwhelmed. Now with your clarifications and extended opinions, I have a better understanding of your ideas, thank you. I do agree that there are different kinds of macros and that there is logic in being more granular and organizing them in separate files. I would support a principled reorganization of the headers. But I feel like we are missing some rough plan of where we are going. |
Sorry about my PRs. I've been moving slowly on them because they aren't automatic fixes and finicky compilation issues (see the 3 week old PR on grabber) really hamper productivity. The PR referred to consists of reorganization of the includes, not the headers and not other modules (beyond making things compile). As such, I did the bare minimum and would prefer another PR to attack the issue better.
One problem that I just realized is that PCL doesn't define which macros are public and which are private. That'd be the first step in making a transition plan. To clarify my thoughts about this PR
The other 2 PR will be mostly merged after a decision has been made on this one since
As such any changes made in the parallel PR wrt pcl_macros can be ignored as I'm making them to keep the direction of my PRs consistent (not necessarily with this one). |
👍
I guess have a different view on Eigen-related macros. We don't have many of them. There is
|
Ready for merge, unless you first want to fix 19.10 |
@kunaltyagi shouldn't the label be "needs: review"? |
Sorry about that. I hope to get fewer errors as days go by |
@aPonza Could you resolve the conflicts please? |
d77ab60
to
903f8b3
Compare
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.
Needs merge, not for 1.10.1
…hared_ptr and pcl::make_shared into memory.h
…its.h/make_shared.h (and fix some transitive dependencies)
903f8b3
to
d890e9f
Compare
@PointCloudLibrary/maintainers Since we've decide to cherry pick for 1.10.1 can we merge this now? |
#undef Success
in pcl_macros.h by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into eigen_base.h#undef Success
in pcl_macros.h by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into memory.h
#undef Success
in pcl_macros.h by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into memory.h#undef Success
in "pcl_macros.h" by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into "memory.h"
#undef Success
in "pcl_macros.h" by extracting PCL_MAKE_ALIGNED_OPERATOR_NEW
into "memory.h"pcl/make_shared.h
header; extract PCL_MAKE_ALIGNED_OPERATOR_NEW
into pcl/memory.h
This consolidates all memory-related functions, typedefs, and macros in a new header file
pcl/memory.h
. The oldpcl/make_shared.h
is deprecated.Solves an issue in #3545.