Add --macro-file option to parse and apply multiple #define directives
I have several macro files in my project that are included via the -imacro option. To enhance flexibility, I added support for adding custom defines from a file to the build flow.
Example usage:
--macro-file=defines.h
will produce this user defines
Defines: CONFIG_GPIO=1;CONFIG_ADC_INIT_PRIORITY=50;CONFIG_GPIO_INIT_PRIORITY=40;CONFIG_SRAM_SIZE=446;
defines.h contents:
#define CONFIG_GPIO 1
#define CONFIG_ADC_INIT_PRIORITY 50
#define CONFIG_GPIO_INIT_PRIORITY 40
#define CONFIG_SRAM_SIZE 446
Thanks for your contribution.
This needs tests added to TestCmdLineParser. But I have almost the same changes in a local branch which already includes the tests among with some refactorings and slightly cleaner code: https://github.com/firewave/cppcheck/tree/def-param.
Both changesets also lack the documentation in the CLI and manpage.
This should also be used to fix a TODO in tools/defines/run_cppcheck.sh - that's the case I intended the option for.
how is this different from --include option.