-
Notifications
You must be signed in to change notification settings - Fork 246
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
CPP options set/unset in mutltiple header files #577
Comments
I cooked a little script that helps finding options that are set/unset in several places. I only tried from all AD verification experiment "build" dir (but this covers most of the code). I think it would be useful to sort out the few cases where this occurs. The other related task would be make sure most options that are found somewhere in the code are listed (#undef) in one specific (default) CPP header file (so that a user would know where to #define it). I have an other script that I can run to help to find these options. |
Sounds like a good plan. In many cases it's obvious (e.g. ALLOW_PACKUNPACK_METHOD2 related to pkg/ctrl and should not be in AUTODIFF_OPTIONS.h). It would be good to have a list of places where this happens. Does it make sense to post it here, since you (@jm-c) already have a script that finds double definitions? Part of this is done (inefficiently) in some PRs, but it would be good to have a dedicated PR for this. |
I can start a PR with this, but there are a few things that are unclear to me:
Should I just start a (draft) PR and we discuss this as we go along? |
I went back to check for Options defined/undef in multiple header files:
|
Also, I went through the list of all CPP options in the code (720 something), found 2 typo, and plan to open a new PR to clean and fix CPP options. My plan would be to address most of the points above, fix typo and set as "#undef" some of the options that are found in the code but not set anywhere (currently about 180) since:
@mjlosch do you agree or should we proceed differently ? |
@jm-c thanks for taking the initiative here. |
Multiple CPP option setting have been fixed (at least in reference CPP header files, not yet in all verfication exp. code dir). |
This is mostly for AD set-up: I noticed that some (CPP) options could be define/undef in in different option-hear files, which is risky since then it does matter in with order they are included.
For instance, in AD exp. "1D_ocean_ice_column", I found:
ECCO_OPTIONS.h:#define ALLOW_GENCOST_CONTRIBUTION
COST_OPTIONS.h:#undef ALLOW_GENCOST_CONTRIBUTION
and:
AUTODIFF_OPTIONS.h:#undef ALLOW_PACKUNPACK_METHOD2
CTRL_OPTIONS.h:#define ALLOW_PACKUNPACK_METHOD2
To be more explicit, in few pkg/ctrl src file, AUTODIFF_OPTIONS.h is included after CTRL_OPTIONS.h resulting in ALLOW_PACKUNPACK_METHOD2 beeing #undef (despite beeing #define in CTRL_OPTIONS) in these src file.
I think it would be helpful to make it clear where a CPP option is set/unset, and to check that multiple setting of the same
option does not happen.
The text was updated successfully, but these errors were encountered: