首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >查找有问题的宏

查找有问题的宏
EN

Stack Overflow用户
提问于 2017-08-30 01:21:37
回答 1查看 783关注 0票数 2

自从我加入这个项目以来,我的编译输出总是这样:

代码语言:javascript
复制
[  0%] Building CXX object lib-tests/gmock/CMakeFiles/gmock_main.dir/gtest/src/gtest-all.cc.o
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
[  0%] Building CXX object lib-tests/gmock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
[  0%] Building CXX object lib-tests/gmock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:23: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:20: warning: ISO C99 requires whitespace after the macro name
[  0%] Linking CXX static library libgmock_main.a
[  0%] Built target gmock_main

诸若此类。在编译整个项目的每个文件之间总是会有这样的警告,最高可达100%。这只是编译的开始,它从google测试库开始,但我并不特别怀疑它是坏宏的来源。(但它可能是)这很奇怪,因为当我在google上搜索这个警告时,人们会得到代码和宏的快照,但我的编译器不会这样做,我只是得到警告。

我在Debian上使用带有gnu编译器和cmake的CLion。我尝试了多个正则表达式来查找没有空格的宏,但没有找到任何成功。我应该如何识别生成此警告的宏?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-12 20:42:11

感谢@stefan对我的问题的评论,从我的CMakeLists.txt文件中删除了两个标志解决了这个问题。

代码语言:javascript
复制
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -O0 -g -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_RULE_MESSAGES:BOOL=ON")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall -O0 -g")

我仔细检查了一下,删除这些标志并不会隐藏编译器警告,比如未使用的变量等。我不确定删除这些标志会有什么影响。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45944913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档