添加GCC选项C源文件的顶部 [英] Add GCC options to top of C source file
本文介绍了添加GCC选项C源文件的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
时可以放东西在C源文件的顶部,像
Is is possible to put something at the top of the C source file, like
// GCC_OPTIONS=-g,-Wall
这会自动添加这些选项与gcc每次编译该文件的时间?
that will add those options automatically to gcc every time you compile this file?
推荐答案
是的,至少对于一些标志。您可以push和pop 诊断设置是这样的:
Yes it is, at least for some flags. You can push and pop diagnostic settings like this:
#pragma GCC diagnostic error "-pedantic"
#pragma GCC diagnostic warning "-Wall"
此,也可以为<一href=\"http://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html#Function-Specific-Option-Pragmas\"相对=nofollow>在每个功能级别优化级别:
This is also possible for optimization levels on a per-function level:
#pragma GCC optimize ("string"...)
更多信息请参阅这些其他问题:
See these other questions for more information:
- http://stackoverflow.com/questions/395145/switching-off-optimization-for-a-specific-function-in-gcc-4-2-2
- http://stackoverflow.com/questions/965093/selectively-disable-gcc-warnings-for-only-part-of-a-translation-unit/3394305#3394305
这篇关于添加GCC选项C源文件的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文