In our C/C++ Project we use a configuration header (~1000 lines) that is full of #ifdef's and #defines
#if (defined(HW_1) || defined(SOME_TECHNOLOGY_SUPPORTED)) && defined(OTHER_TECHNOLOGY_SUPPORTED)
#define SOME_FEATURE_AVAILABLE
#endif
In our build configuration we predefine some defines that are passed to the compiler. This results in different defines (like SOME_FEATURE_AVEILABLE) in our configuration header.
Since our configuration header is quite big, there is also a bit of a mess.
Are there any alternatives for this #define
hell?
Or are there any tools that help to see in what case which defines are set.
We are developing embedded firmware so we can't replace conditional compiling by runtime if's.
Use the Play Store: The most basic way is to use the Google Play Store to find alternatives. Simply go to the tab of the application you want and look in the lower area.
In case all your #define
's are in a single configuration file, you can try doing a preprocessor-only compilation and then finding all defined macros. E.g.,
$ gcc -DFEATURE1 -DFEATURE2 -E configuration.h | grep '#define'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With