]> granicus.if.org Git - clang/commitdiff
Name the "return-type" DiagGroup and reference it in a few places.
authorSteve Naroff <snaroff@apple.com>
Thu, 30 Apr 2009 17:53:16 +0000 (17:53 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 30 Apr 2009 17:53:16 +0000 (17:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70500 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/Sema/return-silent.c [new file with mode: 0644]
test/Sema/return.c

index 9fdf87482e32a631f709e5fb1009167d940986f7..40d3356c1e404440226ce70119b17695b069d853 100644 (file)
@@ -63,7 +63,7 @@ def Parentheses : DiagGroup<"parentheses">;
 def : DiagGroup<"pointer-arith">;
 def : DiagGroup<"pointer-to-int-cast">;
 def : DiagGroup<"redundant-decls">;
-def : DiagGroup<"return-type">;
+def ReturnType : DiagGroup<"return-type">;
 def : DiagGroup<"sequence-point">;
 def : DiagGroup<"shadow">;
 def : DiagGroup<"shorten-64-to-32">;
index 6448e65bab91830fd67eaf197cf52b7e91f74dce..24912b846f36574377618a70b90d3c4ae5c9e767 100644 (file)
@@ -1603,11 +1603,14 @@ def err_first_argument_to_va_arg_not_of_type_va_list : Error<
   "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">,
+  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">,
+  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">,
+  InGroup<ReturnType>;
 def ext_return_has_void_expr : Extension<
   "void %select{function|method}1 %0 should not return void expression">;
 def err_noreturn_function_has_return_expr : Error<
diff --git a/test/Sema/return-silent.c b/test/Sema/return-silent.c
new file mode 100644 (file)
index 0000000..b3b2a56
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -Wno-return-type -fsyntax-only -verify
+
+int t14() {
+  return;
+}
+
+void t15() {
+  return 1;
+}
index b32b2e9eeb08f051342a50a463429f744b23718b..d96cede68a61a56c0a057caf438090b64aa560a5 100644 (file)
@@ -7,3 +7,6 @@ int t14() {
   return; // expected-warning {{non-void function 't14' should return a value}}
 }
 
+void t15() {
+  return 1; // expected-warning {{void function 't15' should not return a value}}
+}