简体   繁体   English

递归删除预处理器宏

[英]Recursively remove preprocessor macros

I have a source tree for a program I am working on which is written in mixed C/C++ code. 我有一个正在使用的程序的源代码树,该树是用C / C ++混合代码编写的。 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. 出于调试目的,我希望能够在整个树上(递归地)运行诸如unifdef之类的命令行工具,以从所有源文件中删除一组特定的#ifdef/#endif宏。

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. 任何帮助将不胜感激,谢谢。

我已经通过使用以下命令解决了这个问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM