]> granicus.if.org Git - clang/commitdiff
Fix PR2281: these two warnings should be promoted to error on
authorChris Lattner <sabre@nondot.org>
Sun, 4 May 2008 23:52:02 +0000 (23:52 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 May 2008 23:52:02 +0000 (23:52 +0000)
pedantic error.  Perhaps I should add a class of 'extension' that is
'extension that warns by default', which would be cleaner.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50633 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp

index 62f570f6277c2d981a7d392006dd2174e26bae31..e7dacc44fd4ab4488b4bd6196b1eb4f736becad7 100644 (file)
@@ -500,6 +500,15 @@ static void InitializeDiagnostics(Diagnostic &Diags) {
     
   if (MSExtensions) // MS allows unnamed struct/union fields.
     Diags.setDiagnosticMapping(diag::w_no_declarators, diag::MAP_IGNORE);
+
+  // If -pedantic-errors is set, turn extensions that warn by default into
+  // errors. 
+  if (ErrorOnExtensions) {
+    Diags.setDiagnosticMapping(diag::warn_hex_escape_too_large,
+                               diag::MAP_ERROR);
+    Diags.setDiagnosticMapping(diag::warn_octal_escape_too_large,
+                               diag::MAP_ERROR);
+  }
 }
 
 //===----------------------------------------------------------------------===//