4

我目前正在使用默认编译器构建GDCM项目: . 此编译器在其自己的标头中触发警告(请参阅ref):MacOSXclang

In file included from /Users/builder/external/GDCM/Source/MediaStorageAndFileFormat/gdcmJPEG12Codec.cxx:21:
/Users/builder/external/GDCM/Source/MediaStorageAndFileFormat/gdcmJPEGBITSCodec.cxx:336:9: warning: disabled expansion of recursive macro [-Wdisabled-macro-expansion]
    if (setjmp(jerr.setjmp_buffer))
        ^
/Users/builder/llvm/llvm-rel-install/bin/../include/c++/v1/setjmp.h:40:21: note: expanded from macro 'setjmp'
#define setjmp(env) setjmp(env)
                    ^
In file included from /Users/builder/external/GDCM/Source/MediaStorageAndFileFormat/gdcmJPEG12Codec.cxx:21:
/Users/builder/external/GDCM/Source/MediaStorageAndFileFormat/gdcmJPEGBITSCodec.cxx:724:9: warning: disabled expansion of recursive macro [-Wdisabled-macro-expansion]
    if (setjmp(jerr.setjmp_buffer))
        ^
/Users/builder/llvm/llvm-rel-install/bin/../include/c++/v1/setjmp.h:40:21: note: expanded from macro 'setjmp'
#define setjmp(env) setjmp(env)
                    ^
2 warnings generated.

这要么是 llvm 标头中的一个明显错误(我觉得很难相信),要么我遗漏了一些关于 in 使用的setjmp信息C++98

4

1 回答 1

9

两者都不是。这不是 LLVM 标头中的错误,也不是您遗漏了有关使用的内容setjmp,而是您启用了一个警告,该警告恰好也触发了完全有效的代码。大多数警告都是如此。这就是为什么它们是警告而不是错误。这个特定的警告恰好主要在有效代码上触发。这就是为什么它默认不启用,甚至-Wall不包含在-Wextra. 然而你还是启用了它。这很好,但是你应该准备好处理结果。

于 2016-01-10T10:54:08.913 回答