[cfe-commits] r114316 - in /cfe/trunk: include/clang/Basic/ test/Analysis/ test/Misc/ test/Parser/ test/Preprocessor/ test/Sema/ test/SemaCXX/ test/SemaObjC/

Argyrios Kyrtzidis akyrtzi at gmail.com
Sun Sep 19 14:21:44 PDT 2010


Author: akirtzidis
Date: Sun Sep 19 16:21:44 2010
New Revision: 114316

URL: http://llvm.org/viewvc/llvm-project?rev=114316&view=rev
Log:
Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/Analysis/dead-stores.c
    cfe/trunk/test/Analysis/misc-ps.m
    cfe/trunk/test/Misc/caret-diags-macros.c
    cfe/trunk/test/Parser/expressions.m
    cfe/trunk/test/Parser/objc-messaging-1.m
    cfe/trunk/test/Parser/objc-try-catch-1.m
    cfe/trunk/test/Preprocessor/pragma_microsoft.c
    cfe/trunk/test/Sema/enum.c
    cfe/trunk/test/Sema/ext_vector_components.c
    cfe/trunk/test/Sema/i-c-e.c
    cfe/trunk/test/Sema/statements.c
    cfe/trunk/test/Sema/unused-expr.c
    cfe/trunk/test/SemaCXX/cast-conversion.cpp
    cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
    cfe/trunk/test/SemaCXX/overloaded-operator.cpp
    cfe/trunk/test/SemaCXX/warn-unused-variables.cpp
    cfe/trunk/test/SemaObjC/invalid-code.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Sep 19 16:21:44 2010
@@ -2770,16 +2770,16 @@
   "expression is not a constant, but is accepted as one by GNU extensions">, 
   InGroup<GNU>;
 def warn_unused_expr : Warning<"expression result unused">,
-  InGroup<UnusedValue>;
+  InGroup<UnusedValue>, DefaultIgnore;
 def warn_unused_voidptr : Warning<
   "expression result unused; should this cast be to 'void'?">,
-  InGroup<UnusedValue>;
+  InGroup<UnusedValue>, DefaultIgnore;
 def warn_unused_property_expr : Warning<
  "property access result unused - getters should not be used for side effects">,
-  InGroup<UnusedValue>;
+  InGroup<UnusedValue>, DefaultIgnore;
 def warn_unused_call : Warning<
   "ignoring return value of function declared with %0 attribute">,
-  InGroup<UnusedValue>;
+  InGroup<UnusedValue>, DefaultIgnore;
 
 def err_incomplete_type_used_in_type_trait_expr : Error<
   "incomplete type %0 used in type trait expression">;

Modified: cfe/trunk/test/Analysis/dead-stores.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/dead-stores.c (original)
+++ cfe/trunk/test/Analysis/dead-stores.c Sun Sep 19 16:21:44 2010
@@ -300,11 +300,11 @@
   case 7:
     (void)(0 && x);
     (void)y7;
-    (void)(0 || (y8, ({ return; }), 1));  // expected-warning {{expression result unused}}
+    (void)(0 || (y8, ({ return; }), 1));
     (void)x;
     break;
   case 8:
-    (void)(1 && (y9, ({ return; }), 1));  // expected-warning {{expression result unused}}
+    (void)(1 && (y9, ({ return; }), 1));
     (void)x;
     break;
   case 9:

Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Sun Sep 19 16:21:44 2010
@@ -466,7 +466,7 @@
 // It should not crash.
 void test_block_cast() {
   id test_block_cast_aux();
-  (void (^)(void *))test_block_cast_aux(); // expected-warning{{expression result unused}}
+  (void (^)(void *))test_block_cast_aux();
 }
 
 int OSAtomicCompareAndSwap32Barrier();
@@ -673,7 +673,7 @@
 //  when not explicitly used in an "lvalue" context (as far as the analyzer is
 //  concerned). This previously triggered a crash due to an invalid assertion.
 void pr_4988(void) {
-  pr_4988; // expected-warning{{expression result unused}}
+  pr_4988;
 }
 
 // <rdar://problem/7152418> - A 'signed char' is used as a flag, which is

Modified: cfe/trunk/test/Misc/caret-diags-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/caret-diags-macros.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Misc/caret-diags-macros.c (original)
+++ cfe/trunk/test/Misc/caret-diags-macros.c Sun Sep 19 16:21:44 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s > %t 2>&1
+// RUN: %clang_cc1 -fsyntax-only -Wunused-value %s > %t 2>&1
 
 #define M1(x) x
 

Modified: cfe/trunk/test/Parser/expressions.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/expressions.m?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Parser/expressions.m (original)
+++ cfe/trunk/test/Parser/expressions.m Sun Sep 19 16:21:44 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wunused-value -fsyntax-only -verify %s
 
 void test1() {
   @"s";            // expected-warning {{expression result unused}}

Modified: cfe/trunk/test/Parser/objc-messaging-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-messaging-1.m?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-messaging-1.m (original)
+++ cfe/trunk/test/Parser/objc-messaging-1.m Sun Sep 19 16:21:44 2010
@@ -6,21 +6,14 @@
         id a, b, c;
 	[a ii]; // expected-warning{{not found}}
 	[a if: 1 :2]; // expected-warning{{not found}}
-	[a inout: 1 :2 another:(2,3,4)]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
-	[a inout: 1 :2 another:(2,3,4), 6,6,8]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
-	[a inout: 1 :2 another:(2,3,4), (6,4,5),6,8]; // expected-warning{{not found}} \
-           // expected-warning 4{{expression result unused}}
-	[a inout: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
-	[a long: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
-	[a : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
+	[a inout: 1 :2 another:(2,3,4)]; // expected-warning{{not found}}
+	[a inout: 1 :2 another:(2,3,4), 6,6,8]; // expected-warning{{not found}}
+	[a inout: 1 :2 another:(2,3,4), (6,4,5),6,8]; // expected-warning{{not found}}
+	[a inout: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}}
+	[a long: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}}
+	[a : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}}
 
 	// Comma expression as receiver (rdar://6222856)
-	[a, b, c foo]; // expected-warning{{not found}} \
-           // expected-warning 2{{expression result unused}}
+	[a, b, c foo]; // expected-warning{{not found}}
 
 }

Modified: cfe/trunk/test/Parser/objc-try-catch-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-try-catch-1.m?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-try-catch-1.m (original)
+++ cfe/trunk/test/Parser/objc-try-catch-1.m Sun Sep 19 16:21:44 2010
@@ -27,15 +27,13 @@
       return proc();
     }
     @catch (Frob* ex) {
-      @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}} \
-				  // expected-warning {{expression result unused}}
+      @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}}
     }
     @catch (float x) {  // expected-error {{@catch parameter is not a pointer to an interface type}}
       
     }
     @catch(...) {
-      @throw (4,3,proc()); // expected-warning {{expression result unused}} \
-						   // expected-warning {{expression result unused}}
+      @throw (4,3,proc());
     }
   }
 
@@ -48,7 +46,7 @@
 void bar()
 {
   @try {}// expected-error {{@try statement without a @catch and @finally clause}}
-  @"s"; //  expected-warning {{result unused}}
+  @"s";
 }
 
 void baz()

Modified: cfe/trunk/test/Preprocessor/pragma_microsoft.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/pragma_microsoft.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/pragma_microsoft.c (original)
+++ cfe/trunk/test/Preprocessor/pragma_microsoft.c Sun Sep 19 16:21:44 2010
@@ -36,5 +36,5 @@
 
   // If we ever actually *support* __pragma(warning(disable: x)),
   // this warning should go away.
-  MACRO_WITH__PRAGMA // expected-warning {{expression result unused}}
+  MACRO_WITH__PRAGMA
 }

Modified: cfe/trunk/test/Sema/enum.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/enum.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Sema/enum.c (original)
+++ cfe/trunk/test/Sema/enum.c Sun Sep 19 16:21:44 2010
@@ -44,10 +44,10 @@
     ;
   (_Bool)ve2;  // expected-error {{arithmetic or pointer type is required}}
 
-  for (; ;ve2) // expected-warning {{expression result unused}}
+  for (; ;ve2)
     ;
   (void)ve2;
-  ve2;         // expected-warning {{expression result unused}}
+  ve2;
 }
 
 // PR2416

Modified: cfe/trunk/test/Sema/ext_vector_components.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ext_vector_components.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Sema/ext_vector_components.c (original)
+++ cfe/trunk/test/Sema/ext_vector_components.c Sun Sep 19 16:21:44 2010
@@ -16,7 +16,7 @@
 
     vec2.z; // expected-error {{vector component access exceeds type 'float2'}}
     vec2.xyzw; // expected-error {{vector component access exceeds type 'float2'}}
-    vec4.xyzw; // expected-warning {{expression result unused}}
+    vec4.xyzw;
     vec4.xyzc; // expected-error {{illegal vector component name 'c'}}
     vec4.s01z; // expected-error {{illegal vector component name 'z'}}
     vec2 = vec4.s01; // legal, shorten

Modified: cfe/trunk/test/Sema/i-c-e.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/i-c-e.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Sema/i-c-e.c (original)
+++ cfe/trunk/test/Sema/i-c-e.c Sun Sep 19 16:21:44 2010
@@ -50,11 +50,9 @@
 char z[__builtin_constant_p(4) ? 1 : -1];
 
 // Comma tests
-int comma1[0?1,2:3];  // expected-warning {{expression result unused}}
-int comma2[1||(1,2)]; // expected-warning {{expression result unused}} \
-                      // expected-warning {{use of logical || with constant operand}}
-int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}} \
-					// expected-warning {{expression result unused}}
+int comma1[0?1,2:3];
+int comma2[1||(1,2)]; // expected-warning {{use of logical || with constant operand}}
+int comma3[(1,2)]; // expected-warning {{size of static array must be an integer constant expression}}
 
 // Pointer + __builtin_constant_p
 char pbcp[__builtin_constant_p(4) ? (intptr_t)&expr : 0]; // expected-error {{variable length array declaration not allowed at file scope}}

Modified: cfe/trunk/test/Sema/statements.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/statements.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Sema/statements.c (original)
+++ cfe/trunk/test/Sema/statements.c Sun Sep 19 16:21:44 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -Wunused-value -verify
 
 typedef unsigned __uint32_t;
 

Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Sun Sep 19 16:21:44 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code -Wunused-value
 
 int foo(int X, int Y);
 

Modified: cfe/trunk/test/SemaCXX/cast-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cast-conversion.cpp?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cast-conversion.cpp (original)
+++ cfe/trunk/test/SemaCXX/cast-conversion.cpp Sun Sep 19 16:21:44 2010
@@ -15,8 +15,7 @@
 int main () {
   B(10);	// expected-error {{functional-style cast from 'int' to 'B' is not allowed}}
   (B)10;	// expected-error {{C-style cast from 'int' to 'B' is not allowed}}
-  static_cast<B>(10);	// expected-error {{static_cast from 'int' to 'B' is not allowed}} \\
-			// expected-warning {{expression result unused}}
+  static_cast<B>(10);	// expected-error {{static_cast from 'int' to 'B' is not allowed}}
 }
 
 template<class T>

Modified: cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp Sun Sep 19 16:21:44 2010
@@ -12,11 +12,11 @@
   __typeof(int)(a,5)<<a; // expected-error {{excess elements in scalar initializer}}
   void(a), ++a;
   if (int(a)+1) {}
-  for (int(a)+1;;) {} // expected-warning {{expression result unused}}
+  for (int(a)+1;;) {}
   a = sizeof(int()+1);
   a = sizeof(int(1));
   typeof(int()+1) a2; // expected-error {{extension used}}
-  (int(1)); // expected-warning {{expression result unused}}
+  (int(1));
 
   // type-id
   (int())1; // expected-error {{C-style cast from 'int' to 'int ()' is not allowed}}

Modified: cfe/trunk/test/SemaCXX/overloaded-operator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-operator.cpp?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-operator.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-operator.cpp Sun Sep 19 16:21:44 2010
@@ -157,7 +157,7 @@
 
 void test_comma(X x, Y y) {
   bool& b1 = (x, y);
-  X& xr = (x, x); // expected-warning {{expression result unused}}
+  X& xr = (x, x);
 }
 
 struct Callable {

Modified: cfe/trunk/test/SemaCXX/warn-unused-variables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-variables.cpp?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unused-variables.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unused-variables.cpp Sun Sep 19 16:21:44 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-value -verify %s
 template<typename T> void f() {
   T t;
   t = 17;

Modified: cfe/trunk/test/SemaObjC/invalid-code.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-code.m?rev=114316&r1=114315&r2=114316&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-code.m (original)
+++ cfe/trunk/test/SemaObjC/invalid-code.m Sun Sep 19 16:21:44 2010
@@ -9,7 +9,7 @@
 // This previously triggered a crash because the class has not been defined.
 @implementation RDar7495713 (rdar_7495713_cat)  // expected-error{{cannot find interface declaration for 'RDar7495713'}}
 - (id) rdar_7495713 {
-  __PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
+  __PRETTY_FUNCTION__;
 }
 @end
 





More information about the cfe-commits mailing list