r203974 - Add two missing entries to the C++11 support page. Bump one relevant diagnostic
Richard Smith
richard-llvm at metafoo.co.uk
Fri Mar 14 14:21:25 PDT 2014
Author: rsmith
Date: Fri Mar 14 16:21:24 2014
New Revision: 203974
URL: http://llvm.org/viewvc/llvm-project?rev=203974&view=rev
Log:
Add two missing entries to the C++11 support page. Bump one relevant diagnostic
(for an integer too large for any signed type) from Warning to ExtWarn -- it's
ill-formed in C++11 and C99 onwards, and UB during translation in C89 and
C++98. Add diagnostic groups for two relevant diagnostics.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Misc/warning-flags.c
cfe/trunk/www/cxx_status.html
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Fri Mar 14 16:21:24 2014
@@ -104,8 +104,9 @@ def warn_cxx98_compat_longlong : Warning
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def err_integer_too_large : Error<
"integer constant is larger than the largest unsigned integer type">;
-def warn_integer_too_large_for_signed : Warning<
- "integer constant is larger than the largest signed integer type">;
+def ext_integer_too_large_for_signed : ExtWarn<
+ "integer constant is larger than the largest signed integer type">,
+ InGroup<DiagGroup<"implicitly-unsigned-literal">>;
// Sema && AST
def note_invalid_subexpr_in_const_expr : Note<
Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Mar 14 16:21:24 2014
@@ -151,7 +151,8 @@ def warn_ucn_not_valid_in_c89_literal :
// Literal
def ext_nonstandard_escape : Extension<
"use of non-standard escape character '\\%0'">;
-def ext_unknown_escape : ExtWarn<"unknown escape sequence '\\%0'">;
+def ext_unknown_escape : ExtWarn<"unknown escape sequence '\\%0'">,
+ InGroup<DiagGroup<"unknown-escape-sequence">>;
def err_invalid_decimal_digit : Error<"invalid digit '%0' in decimal constant">;
def err_invalid_binary_digit : Error<"invalid digit '%0' in binary constant">;
def err_invalid_octal_digit : Error<"invalid digit '%0' in octal constant">;
Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Fri Mar 14 16:21:24 2014
@@ -258,9 +258,10 @@ static bool EvaluateValue(PPValue &Resul
// large that it is unsigned" e.g. on 12345678901234567890 where intmax_t
// is 64-bits.
if (!Literal.isUnsigned && Result.Val.isNegative()) {
- // Don't warn for a hex or octal literal: 0x8000..0 shouldn't warn.
+ // Octal, hexadecimal, and binary literals are implicitly unsigned if
+ // the value does not fit into a signed integer type.
if (ValueLive && Literal.getRadix() == 10)
- PP.Diag(PeekTok, diag::warn_integer_too_large_for_signed);
+ PP.Diag(PeekTok, diag::ext_integer_too_large_for_signed);
Result.Val.setIsUnsigned(true);
}
}
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Mar 14 16:21:24 2014
@@ -3210,7 +3210,7 @@ ExprResult Sema::ActOnNumericConstant(co
// If we still couldn't decide a type, we probably have something that
// does not fit in a signed long long, but has no U suffix.
if (Ty.isNull()) {
- Diag(Tok.getLocation(), diag::warn_integer_too_large_for_signed);
+ Diag(Tok.getLocation(), diag::ext_integer_too_large_for_signed);
Ty = Context.UnsignedLongLongTy;
Width = Context.getTargetInfo().getLongLongWidth();
}
Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Fri Mar 14 16:21:24 2014
@@ -18,7 +18,7 @@ This test serves two purposes:
The list of warnings below should NEVER grow. It should gradually shrink to 0.
-CHECK: Warnings without flags (108):
+CHECK: Warnings without flags (106):
CHECK-NEXT: ext_delete_void_ptr_operand
CHECK-NEXT: ext_expected_semi_decl_list
CHECK-NEXT: ext_explicit_specialization_storage_class
@@ -35,7 +35,6 @@ CHECK-NEXT: ext_typecheck_cond_incompa
CHECK-NEXT: ext_typecheck_cond_incompatible_operands_nonstandard
CHECK-NEXT: ext_typecheck_ordered_comparison_of_function_pointers
CHECK-NEXT: ext_typecheck_ordered_comparison_of_pointer_integer
-CHECK-NEXT: ext_unknown_escape
CHECK-NEXT: ext_using_undefined_std
CHECK-NEXT: pp_include_next_absolute_path
CHECK-NEXT: pp_include_next_in_primary
@@ -83,7 +82,6 @@ CHECK-NEXT: warn_implements_nscopying
CHECK-NEXT: warn_incompatible_qualified_id
CHECK-NEXT: warn_initializer_string_for_char_array_too_long
CHECK-NEXT: warn_inline_namespace_reopened_noninline
-CHECK-NEXT: warn_integer_too_large_for_signed
CHECK-NEXT: warn_invalid_asm_cast_lvalue
CHECK-NEXT: warn_maynot_respond
CHECK-NEXT: warn_method_param_redefinition
Modified: cfe/trunk/www/cxx_status.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=203974&r1=203973&r2=203974&view=diff
==============================================================================
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Mar 14 16:21:24 2014
@@ -205,8 +205,16 @@ currently requires the C++ runtime libra
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">N2341</a></td>
<td class="full" align="center">Clang 3.3</td>
</tr>
- <!-- Skipped N1627: Conditionally-support behavior -->
- <!-- Skipped N1727: Changing Undefined Behavior into Diagnosable Errors -->
+ <tr>
+ <td>Conditionally-support behavior</td>
+ <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1627.pdf">N1627</a></td>
+ <td class="full" align="center">Clang 2.9</td>
+ </tr>
+ <tr>
+ <td>Changing undefined behavior into diagnosable errors</td>
+ <td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1727.pdf">N1727</a></td>
+ <td class="full" align="center">Clang 2.9</td>
+ </tr>
<tr>
<td>Delegating constructors</td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf">N1986</a></td>
More information about the cfe-commits
mailing list