Split off the binary literal warning into a subgroup of C++14 warnings

Binary literals predate C++14, but they are listed as a C++14 extension since
this was the first time they were standardized in the language.  Move the
warning into a subgroup so it can be selectively disabled when checking for
other C++14 features.

llvm-svn: 248064
This commit is contained in:
Richard Trieu
2015-09-18 23:18:39 +00:00
parent 8197a4e0bf
commit 324da7b207
3 changed files with 8 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ def ArrayBoundsPointerArithmetic : DiagGroup<"array-bounds-pointer-arithmetic">;
def Availability : DiagGroup<"availability">;
def Section : DiagGroup<"section">;
def AutoImport : DiagGroup<"auto-import">;
def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">;
def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
def GNUCompoundLiteralInitializer : DiagGroup<"gnu-compound-literal-initializer">;
def BitFieldConstantConversion : DiagGroup<"bitfield-constant-conversion">;
@@ -680,7 +681,7 @@ def CXX11 : DiagGroup<"c++11-extensions", [CXX11ExtraSemi, CXX11LongLong]>;
// A warning group for warnings about using C++14 features as extensions in
// earlier C++ versions.
def CXX14 : DiagGroup<"c++14-extensions">;
def CXX14 : DiagGroup<"c++14-extensions", [CXX14BinaryLiteral]>;
// A warning group for warnings about using C++1z features as extensions in
// earlier C++ versions.

View File

@@ -184,7 +184,7 @@ def ext_hexconstant_invalid : Extension<
def ext_binary_literal : Extension<
"binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;
def ext_binary_literal_cxx14 : Extension<
"binary integer literals are a C++14 extension">, InGroup<CXX14>;
"binary integer literals are a C++14 extension">, InGroup<CXX14BinaryLiteral>;
def warn_cxx11_compat_binary_literal : Warning<
"binary integer literals are incompatible with C++ standards before C++14">,
InGroup<CXXPre14CompatPedantic>, DefaultIgnore;

View File

@@ -0,0 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wc++14-binary-literal
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wc++14-extensions
int x = 0b11;
// expected-warning@-1{{binary integer literals are a C++14 extension}}