clang - 如何获取Clang支持的标准列表?

标签 clang

我在MAN中找到了这个:

   -std=language
       Specify the language standard to compile for.

   -ansi
       Same as -std=c89.

但是在哪里可以找到我已安装的编译器支持的所有标准的列表?
clang -std=??? test.c

最佳答案

检查此文件: llvm.git/tools/clang/include/clang/Frontend/LangStandards.def
online version from github
编译器支持的标准正在不断变化,您可以检查此文件并自己尝试。

// C++ modes
LANGSTANDARD(cxx98, "c++98",
             "ISO C++ 1998 with amendments",
             LineComment | CPlusPlus | Digraphs)
LANGSTANDARD(cxx03, "c++03",
             "ISO C++ 1998 with amendments",
             LineComment | CPlusPlus | Digraphs)
LANGSTANDARD(gnucxx98, "gnu++98",
             "ISO C++ 1998 with amendments and GNU extensions",
             LineComment | CPlusPlus | Digraphs | GNUMode)

LANGSTANDARD(cxx0x, "c++0x",
             "ISO C++ 2011 with amendments",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
LANGSTANDARD(cxx11, "c++11",
             "ISO C++ 2011 with amendments",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
LANGSTANDARD(gnucxx0x, "gnu++0x",
             "ISO C++ 2011 with amendments and GNU extensions",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
LANGSTANDARD(gnucxx11, "gnu++11",
             "ISO C++ 2011 with amendments and GNU extensions",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)

关于clang - 如何获取Clang支持的标准列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21870283/

相关文章:

c++ - clang 问题 --analyze

compiler-construction - clang 中的 CUDA 支持

c++ - 在 macOS 上将 -fuse-ld=lld 与 Clang 一起使用

clang - 使用 LLVM 3.3 后端为 AMD 编译 OpenCL

c++ - 可疑情况下的 Clang 警告 : function 'foo' could be declared with attribute 'noreturn' ?

c++ - 我的 lambda 参数真的影响了我的本地人吗?

c++ - MacPorts clang 不使用自己的 header

c++ - 神秘的链接器错误 "undefined reference to ` __gxx_personality_v 0'"在 cygwin 中使用 clang

objective-c - 在 macOS Sierra 上用 clang 编译 Objective-C

c++ - 在使用声明引入的折叠表达式中使用运算符是否合法?