[cfe-commits] r108108 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td test/Analysis/null-deref-ps.c test/CodeGen/statements.c test/Rewriter/dllimport-typedef.c test/Rewriter/missing-dllimport.c test/Sema/function.c test/Sema/implicit-decl.c test/Sema/return.c test/SemaTemplate/instantiate-function-1.cpp

Chris Lattner sabre at nondot.org
Sun Jul 11 16:34:02 PDT 2010


Author: lattner
Date: Sun Jul 11 18:34:02 2010
New Revision: 108108

URL: http://llvm.org/viewvc/llvm-project?rev=108108&view=rev
Log:
fix PR7280 by making the warning on code like this:

int test1() {
  return;
}

default to an error.


Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/Analysis/null-deref-ps.c
    cfe/trunk/test/CodeGen/statements.c
    cfe/trunk/test/Rewriter/dllimport-typedef.c
    cfe/trunk/test/Rewriter/missing-dllimport.c
    cfe/trunk/test/Sema/function.c
    cfe/trunk/test/Sema/implicit-decl.c
    cfe/trunk/test/Sema/return.c
    cfe/trunk/test/SemaTemplate/instantiate-function-1.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Jul 11 18:34:02 2010
@@ -3053,13 +3053,13 @@
   "first argument to 'va_arg' is of type %0 and not 'va_list'">;
 
 def warn_return_missing_expr : Warning<
-  "non-void %select{function|method}1 %0 should return a value">,
+  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
   InGroup<ReturnType>;
 def ext_return_missing_expr : ExtWarn<
-  "non-void %select{function|method}1 %0 should return a value">,
+  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
   InGroup<ReturnType>;
 def ext_return_has_expr : ExtWarn<
-  "void %select{function|method}1 %0 should not return a value">,
+  "void %select{function|method}1 %0 should not return a value">, DefaultError,
   InGroup<ReturnType>;
 def ext_return_has_void_expr : Extension<
   "void %select{function|method}1 %0 should not return void expression">;

Modified: cfe/trunk/test/Analysis/null-deref-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/null-deref-ps.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/null-deref-ps.c (original)
+++ cfe/trunk/test/Analysis/null-deref-ps.c Sun Jul 11 18:34:02 2010
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=basic -analyzer-store=basic
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=range -analyzer-store=basic
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=basic -analyzer-store=basic -Wreturn-type 
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=range -analyzer-store=basic -Wreturn-type 
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s -Wreturn-type 
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type 
 
 typedef unsigned uintptr_t;
 

Modified: cfe/trunk/test/CodeGen/statements.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/statements.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/statements.c (original)
+++ cfe/trunk/test/CodeGen/statements.c Sun Jul 11 18:34:02 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 < %s -emit-llvm
+// RUN: %clang_cc1 -Wreturn-type < %s -emit-llvm
 
 void test1(int x) {
 switch (x) {

Modified: cfe/trunk/test/Rewriter/dllimport-typedef.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/dllimport-typedef.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/dllimport-typedef.c (original)
+++ cfe/trunk/test/Rewriter/dllimport-typedef.c Sun Jul 11 18:34:02 2010
@@ -9,9 +9,9 @@
 // diagnostics we expect.
 void bar() { return 1; }
 
-// CHECK-NEG: warning: void function 'bar' should not return a value
-// CHECK-NEG: 1 warning generated
+// CHECK-NEG: error: void function 'bar' should not return a value
+// CHECK-NEG: 1 error generated
 // CHECK-POS: warning: 'dllimport' attribute only applies to variable and function type
-// CHECK-POS: warning: void function 'bar' should not return a value
-// CHECK-POS: 2 warnings generated
+// CHECK-POS: error: void function 'bar' should not return a value
+// CHECK-POS: 1 warning and 1 error generated
 

Modified: cfe/trunk/test/Rewriter/missing-dllimport.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/missing-dllimport.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/missing-dllimport.c (original)
+++ cfe/trunk/test/Rewriter/missing-dllimport.c Sun Jul 11 18:34:02 2010
@@ -11,9 +11,9 @@
 // diagnostics we expect.
 void bar() { return 1; }
 
-// CHECK-NEG: warning: void function 'bar' should not return a value
-// CHECK-NEG: 1 warning generated
+// CHECK-NEG: error: void function 'bar' should not return a value
+// CHECK-NEG: 1 error generated
 // CHECK-POS: warning: 'foo' redeclared without dllimport attribute: previous dllimport ignored
-// CHECK-POS: warning: void function 'bar' should not return a value
-// CHECK-POS: 2 warnings generated
+// CHECK-POS: error: void function 'bar' should not return a value
+// CHECK-POS: 1 warning and 1 error generated
 

Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Sun Jul 11 18:34:02 2010
@@ -34,10 +34,10 @@
 
 // PR2790
 void t13() {
-  return 0; // expected-warning {{void function 't13' should not return a value}}
+  return 0; // expected-error {{void function 't13' should not return a value}}
 }
 int t14() {
-  return; // expected-warning {{non-void function 't14' should return a value}}
+  return; // expected-error {{non-void function 't14' should return a value}}
 }
 
 // <rdar://problem/6097326>

Modified: cfe/trunk/test/Sema/implicit-decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-decl.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Sema/implicit-decl.c (original)
+++ cfe/trunk/test/Sema/implicit-decl.c Sun Jul 11 18:34:02 2010
@@ -10,7 +10,6 @@
    if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} \
          expected-warning {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}}
    }
-   return ((void *)0); // expected-warning {{void function 'func' should not return a value}}
 }
 Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error{{conflicting types for '_CFCalendarDecomposeAbsoluteTimeV'}}
  return 0;

Modified: cfe/trunk/test/Sema/return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return.c?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/Sema/return.c (original)
+++ cfe/trunk/test/Sema/return.c Sun Jul 11 18:34:02 2010
@@ -1,4 +1,4 @@
-// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
+// RUN: %clang %s -fsyntax-only -Wreturn-type -Xclang -verify -fblocks -Wno-unreachable-code -Wno-unused-value
 
 // clang emits the following warning by default.
 // With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the 

Modified: cfe/trunk/test/SemaTemplate/instantiate-function-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-function-1.cpp?rev=108108&r1=108107&r2=108108&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-function-1.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-function-1.cpp Sun Jul 11 18:34:02 2010
@@ -39,11 +39,11 @@
 
 template <typename T> struct X4 {
   T f() const {
-    return; // expected-warning{{non-void function 'f' should return a value}}
+    return; // expected-error{{non-void function 'f' should return a value}}
   }
   
   T g() const {
-    return 1; // expected-warning{{void function 'g' should not return a value}}
+    return 1; // expected-error{{void function 'g' should not return a value}}
   }
 };
 





More information about the cfe-commits mailing list