[cfe-commits] r140008 - in /cfe/trunk: lib/Sema/JumpDiagnostics.cpp test/SemaCXX/MicrosoftCompatibility.cpp test/SemaCXX/MicrosoftExtensions.cpp

Francois Pichet pichet2000 at gmail.com
Sun Sep 18 14:48:27 PDT 2011


Author: fpichet
Date: Sun Sep 18 16:48:27 2011
New Revision: 140008

URL: http://llvm.org/viewvc/llvm-project?rev=140008&view=rev
Log:
Move the "jump bypasses variable initialization" error -> warning downgrade from -fms-extensions to -fms-compatibility.

Modified:
    cfe/trunk/lib/Sema/JumpDiagnostics.cpp
    cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp
    cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp

Modified: cfe/trunk/lib/Sema/JumpDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/JumpDiagnostics.cpp?rev=140008&r1=140007&r2=140008&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/JumpDiagnostics.cpp (original)
+++ cfe/trunk/lib/Sema/JumpDiagnostics.cpp Sun Sep 18 16:48:27 2011
@@ -694,7 +694,7 @@
   SmallVector<unsigned, 10> ToScopesError;
   SmallVector<unsigned, 10> ToScopesWarning;
   for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
-    if (S.getLangOptions().MicrosoftExt && JumpDiagWarning != 0 &&
+    if (S.getLangOptions().MicrosoftMode && JumpDiagWarning != 0 &&
         IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag))
       ToScopesWarning.push_back(I);
     else if (Scopes[I].InDiag)

Modified: cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp?rev=140008&r1=140007&r2=140008&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftCompatibility.cpp Sun Sep 18 16:48:27 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions
 
 
 
@@ -16,3 +16,57 @@
 
 }
 
+
+
+namespace ms_protected_scope {
+  struct C { C(); };
+
+  int jump_over_variable_init(bool b) {
+    if (b)
+      goto foo; // expected-warning {{illegal goto into protected scope}}
+    C c; // expected-note {{jump bypasses variable initialization}}
+  foo:
+    return 1;
+  }
+
+struct Y {
+  ~Y();
+};
+
+void jump_over_var_with_dtor() {
+  goto end; // expected-warning{{goto into protected scope}}
+  Y y; // expected-note {{jump bypasses variable initialization}}
+ end:
+    ;
+}
+
+  void jump_over_variable_case(int c) {
+    switch (c) {
+    case 0:
+      int x = 56; // expected-note {{jump bypasses variable initialization}}
+    case 1:       // expected-error {{switch case is in protected scope}}
+      x = 10;
+    }
+  }
+
+ 
+void exception_jump() {
+  goto l2; // expected-error {{illegal goto into protected scope}}
+  try { // expected-note {{jump bypasses initialization of try block}}
+     l2: ;
+  } catch(int) {
+  }
+}
+
+int jump_over_indirect_goto() {
+  static void *ps[] = { &&a0 };
+  goto *&&a0; // expected-warning {{goto into protected scope}}
+  int a = 3; // expected-note {{jump bypasses variable initialization}}
+ a0:
+  return 0;
+}
+  
+}
+
+
+

Modified: cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp?rev=140008&r1=140007&r2=140008&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp Sun Sep 18 16:48:27 2011
@@ -257,56 +257,3 @@
 
 }
 
-
-namespace ms_protected_scope {
-  struct C { C(); };
-
-  int jump_over_variable_init(bool b) {
-    if (b)
-      goto foo; // expected-warning {{illegal goto into protected scope}}
-    C c; // expected-note {{jump bypasses variable initialization}}
-  foo:
-    return 1;
-  }
-
-struct Y {
-  ~Y();
-};
-
-void jump_over_var_with_dtor() {
-  goto end; // expected-warning{{goto into protected scope}}
-  Y y; // expected-note {{jump bypasses variable initialization}}
- end:
-    ;
-}
-
-  void jump_over_variable_case(int c) {
-    switch (c) {
-    case 0:
-      int x = 56; // expected-note {{jump bypasses variable initialization}}
-    case 1:       // expected-error {{switch case is in protected scope}}
-      x = 10;
-    }
-  }
-
- 
-void exception_jump() {
-  goto l2; // expected-error {{illegal goto into protected scope}}
-  try { // expected-note {{jump bypasses initialization of try block}}
-     l2: ;
-  } catch(int) {
-  }
-}
-
-int jump_over_indirect_goto() {
-  static void *ps[] = { &&a0 };
-  goto *&&a0; // expected-warning {{goto into protected scope}}
-  int a = 3; // expected-note {{jump bypasses variable initialization}}
- a0:
-  return 0;
-}
-  
-}
-
-
-





More information about the cfe-commits mailing list