Recursively remove preprocessor macros

2019-03-04 15:33发布

I have a source tree for a program I am working on which is written in mixed C/C++ code. For debugging purposes, I would like to be able to run a command line tool like unifdef on the entire tree (recursively) to remove a certain set of #ifdef/#endif macros from all source files.

I was wondering if there was any specific way I could go about doing this in an efficient way. Any help would be appriciated, thank you.

标签: c++ c building
1条回答
倾城 Initia
2楼-- · 2019-03-04 15:58

I've solved this issue by using the following command:

find . -name '*.c' -o -name '*.h' -o -name '*.cpp' -o -name '*.hpp' -exec unifdef <macro definitions> -o '{} {} ;'

查看更多
登录 后发表回答