-
Notifications
You must be signed in to change notification settings - Fork 317
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
[SofaKernel] Header include cleanup #638
[SofaKernel] Header include cleanup #638
Conversation
C2057: expected constant expression
…template is used. This fix error C2057 on stl container.
…ide sofaBaseCollision headers.
…BaseVisual and SofaBaseTopology.
…now in application_SofaGuiGlut
…er headers. Remove GeneralLoader.h and GeneralLoader.cpp which are not anymore used.
[ci-build][with-scene-tests] |
@@ -21,11 +21,8 @@ | |||
******************************************************************************/ | |||
#ifndef SOFA_COMPONENT_LOADER_SPHERELOADER_H | |||
#define SOFA_COMPONENT_LOADER_SPHERELOADER_H | |||
#include "config.h" |
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 about removing this one....because no one will define SOFA_TARGET anymore.
While it is supposed to be used in the ObjectFactory:
/// The name of the library or executable containing the binary code for this component
virtual const char* getTarget()
{
#ifdef SOFA_TARGET
return sofa_tostring(SOFA_TARGET);
#else
return "";
#endif
}
EDIT: Actually all the component in SofaGeneralLoader should have somewhere the target set to SOFA_TARGET "SofaGeneralLoader" (which I'm sure is what is happening).
NB: I'm really not found of silently ignoring the undefined SOFA_TARGET.
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.
ok I can revert that. I think it has been removed because this class include already another loader header that include config.h
If the logic is: every class include it's config.h, I'm ok with it.
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.
Maybe we should replace this code by:
#ifndef SOFA_TARGET
#error....the SOFA_TARGET is not defined.
#else:
return sofa_tostring(SOFA_TARGET);
#endif
(Not in this PR of course)
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 will put those headers back and we will see later where those target should be set.
@@ -1,33 +0,0 @@ | |||
/****************************************************************************** |
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.
Hello Erik,
I'm not sure this one should be removed, on the contrary its use should be generalized. Additionally I think it should also define the SOFA_TARGET to SofaGeneralLoader.
Please confirm @guparan
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.
Ok I sent a message to @guparan already regarding this.
Right now all macros are defined in sofa-build\include\SofaMisc\config.h etc..
This class is not included. Let me know which one should be kept. I'll revert the commit if needed.
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 will report our discussion in an issue and remove that change from the PR to have only changes on header includes.
@@ -1,35 +0,0 @@ | |||
/****************************************************************************** |
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.
Why did you removed also code ?
From PR description I would have expected only changing lines with #include
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.
yes, I saw all includes could be removed because this class is not anymore in the cmakeLists.
Another PR regarding deprecated files will be better indeed because I found other similar cases.
…a::core::topology
…fa::module::topology
…:visual . Had to put back include of gl.h in several components.
…that has no include at all....
[ci-build][with-scene-tests] |
READY and recently compiled over the issofa PR ...I merge it. |
@@ -22,17 +22,14 @@ | |||
#ifndef SOFA_CORE_BEHAVIOR_BASEMECHANICALSTATE_H | |||
#define SOFA_CORE_BEHAVIOR_BASEMECHANICALSTATE_H | |||
|
|||
#include <sofa/config/build_option_experimental_features.h> |
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 merged without noticing this one.
It shouldnt be removed.
Because this one add some macro that are tested with
#ifdef XXXXX
So removing it "compile" but the resulting code is not working anymore.
....
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.
A very bad things is that even in condition like #if MACRO == 1
When the macro is not defined then its value is == 0 so removing the include line is silent.
https://gcc.gnu.org/onlinedocs/cpp/If.html
A workaround I can propose it to do:
#define MYTEST() 0
....
#if MYTEST()
std::cout << "COUCOU A" << std::endl ;
#else
std::cout << "COUCOU B" << std::endl ;
#endif
So that we get error when MYTEST is not defined (the bad things is that the error is not very clear with some compilers):
with gcc:
toto.cpp:8:11: error: missing binary operator before token "("
#if MYTEST()
with clang:
toto.cpp:8:5: error: function-like macro 'MYTEST' is not defined
#if MYTEST()
^
Just removing unnecessary headers include inside header in sofa::core
No forward class or intelligent refactoring.
any suggestion/remark is welcomed.
This PR:
Reviewers will merge only if all these checks are true.