简体   繁体   English

如何找出在Linux驱动程序中定义的预处理器

[英]how to find out preprocessors defined in linux driver

Is there a way to find out what preprocessors are defined in your linux driver/kernel code when building? 有没有一种方法可以在构建时找出在Linux驱动程序/内核代码中定义了哪些预处理器? I could use a text search tool (I actually did), but I inherit a big tree of linux driver/kernel code. 我可以使用文本搜索工具(实际上是这样做的),但是我继承了Linux驱动程序/内核代码的大树。 It's so big that my text search tool gets an error when I search for a certain preprocessor in the whole code tree. 它太大了,当我在整个代码树中搜索某个预处理器时,我的文本搜索工具会出错。

gcc can dump all defined macros to stdout in preprocessing mode: gcc可以在预处理模式下将所有定义的宏转储到stdout:

gcc -E -dM foo.c

This includes any macros predefined by the compiler, which can be a little annoying. 这包括编译器预定义的任何宏,可能有些烦人。 In any case, you should be able to hack up your Makefile to contain a target that dumps this information to files for each compilation unit. 无论如何,您都应该能够破解Makefile,使其包含一个目标,该目标将这些信息转储到每个编译单元的文件中。

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

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