作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 OS X 上使用 MacPorts GCC 并通过 -Wa,-q
使用 Clang 集成汇编器时,汇编器会为每个文件生成一个警告流。下面显示了警告的示例(其中太多,Stack Overflow 编辑器不允许我粘贴整个流)。
我找到了 LLVM Commit r250349, Stop generating coal sections .这是负责的代码,但我不清楚如何禁用警告。
+ // Issue a warning if the target is not powerpc and Section is a *coal* section.
+ Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple();
+ Triple::ArchType ArchTy = TT.getArch();
+
+ if (ArchTy != Triple::ppc && ArchTy != Triple::ppc64) {
+ StringRef NonCoalSection = StringSwitch<StringRef>(Section)
+ .Case("__textcoal_nt", "__text")
+ .Case("__const_coal", "__const")
+ .Case("__datacoal_nt", "__data")
+ .Default(Section);
+
+ if (!Section.equals(NonCoalSection)) {
+ StringRef SectionVal(Loc.getPointer());
+ size_t B = SectionVal.find(',') + 1, E = SectionVal.find(',', B);
+ SMLoc BLoc = SMLoc::getFromPointer(SectionVal.data() + B);
+ SMLoc ELoc = SMLoc::getFromPointer(SectionVal.data() + E);
+ getParser().Warning(Loc, "section \"" + Section + "\" is deprecated",
+ SMRange(BLoc, ELoc));
+ getParser().Note(Loc, "change section name to \"" + NonCoalSection +
+ "\"", SMRange(BLoc, ELoc));
+ }
+ }
+
2 > /dev/null
因为目前配置有点脆弱,它会丢弃其他警告和错误。
-Wa,-q
,它使用
/opt/local/bin/clang
作为汇编程序而不是
/opt/local/bin/as
.以下是相关版本。
$ /opt/local/bin/g++-mp-6 --version
g++-mp-6 (MacPorts gcc6 6.1.0_0) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
$ /opt/local/bin/clang --version
clang version 3.8.0 (branches/release_38 262722)
Target: x86_64-apple-darwin12.6.0
$ /opt/local/bin/as -version
Apple Inc version cctools-877.8, GNU assembler version 1.38
-Wno-deprecated
至
CXXFLAGS
不抑制警告。我也试过
-fno-tree-coalesce-vars
没有快乐(这可能会影响性能)。
sed
使用
sed
在 OS X 上不匹配或
gsed
:
$ CXXFLAGS="-DNDEBUG -g2 -O2" make CXX=/opt/local/bin/g++-mp-6 2>&1 | \
gsed -e '/(__TEXT|__DATA)/,+2d'
/opt/local/bin/g++-mp-6 -DNDEBUG -g2 -O2 -fPIC -march=native -Wa,-q -pipe -c rijndael.cpp
<stdin>:3:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
...
/opt/local/bin/g++-mp-6 -DNDEBUG -g2 -O2 -fPIC -march=native -Wa,-q -DMACPORTS_GCC_COMPILER=1 -c cryptlib.cpp
<stdin>:3:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:2665:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:2665:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3925:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3925:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3963:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
<stdin>:3963:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
[Hundred of these ommitted for each source file]
最佳答案
目前,您无法禁用这些警告。您可能应该针对 FSF GCC 提交错误报告,让他们更新他们的代码生成器以使其更加合规。
您可能还想向 llvm.org 提交错误报告,以请求有一种方法可以使这些警告静音或限制发出的数量,以免淹没用户。
关于macos - 禁用汇编器警告 ".section __TEXT,__textcoal_nt,coalesced,pure_instructions",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38193043/
在 OS X 上使用 MacPorts GCC 并通过 -Wa,-q 使用 Clang 集成汇编器时,汇编器会为每个文件生成一个警告流。下面显示了警告的示例(其中太多,Stack Overflow 编
这个问题在这里已经有了答案: Disable assembler warning ".section __TEXT,__textcoal_nt,coalesced,pure_instructions
我是一名优秀的程序员,十分优秀!