免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 9138 | 回复: 2
打印 上一主题 下一主题

gcc的-Wp,MD参数是什么意思,没有看明白。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-06 07:34 |只看该作者 |倒序浏览
Options Controlling the Preprocessor

       These options control the C preprocessor, which is run on each C source file before actual compilation.

       If you use the -E option, nothing is done except preprocessing.  Some of these options make sense only together with -E because they cause the
       preprocessor output to be unsuitable for actual compilation.

           You can use -Wp,option to bypass the compiler driver and pass option directly through to the preprocessor.  If option contains commas, it is
           split into multiple options at the commas.  However, many options are modified, translated or interpreted by the compiler driver before being
           passed to the preprocessor, and -Wp forcibly bypasses this phase. (为什么要绕过compiler driver呢?哪些选择会被compiler修改,翻译和解释呢?) The preprocessor's direct interface is undocumented and subject to change,
           so whenever possible you should avoid using -Wp and let the driver handle the options instead.


  -MD -MD is equivalent to -M -MF file, except that -E is not implied.(这是默认没有-E选项的意思吧)  The driver determines file based on whether an -o option is given.  If it
           is, the driver uses its argument but with a suffix of .d, otherwise it take the basename of the input file and applies a .d suffix.

           If -MD is used in conjunction with -E, any -o switch is understood to specify the dependency output file, but if used without -E, each -o is
           understood to specify a target object file.


           Since -E is not implied, -MD can be used to generate a dependency output file as a side-effect of the compilation process.

论坛徽章:
1
天蝎座
日期:2013-12-06 18:23:58
2 [报告]
发表于 2011-07-06 08:41 |只看该作者
这个是说 最好不要用Wp选项吧, 让编译器处理传递给他的参数,编译器可能会对这个参数做出一些改动。 除非你确定你能做的更好,不需要编译器替你这么做。强制掠过该过程

MD 是用来生成依赖文件的? 应该是给Makefile用的吧 -M 和-MD -MF一样,D生成的文件会有 .d 后缀 F是吧输出到指定文件。

论坛徽章:
0
3 [报告]
发表于 2011-07-06 20:29 |只看该作者
既然最好不要用-Wp参数,那么哪种情况下确实需要使用呢?能举一个例子?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP