"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">;
-// 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;
-// RUN: %clang_cc1 < %s -emit-llvm
+// RUN: %clang_cc1 -Wreturn-type < %s -emit-llvm
void test1(int x) {
switch (x) {
// 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
// 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
// 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>
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;
-// 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
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}}
}
};