From 940ab971c580ca03da2e68ec92b9c0f7acfe6988 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Thu, 30 Apr 2009 17:53:16 +0000 Subject: [PATCH] Name the "return-type" DiagGroup and reference it in a few places. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70500 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticGroups.td | 2 +- include/clang/Basic/DiagnosticSemaKinds.td | 9 ++++++--- test/Sema/return-silent.c | 9 +++++++++ test/Sema/return.c | 3 +++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 test/Sema/return-silent.c diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 9fdf87482e..40d3356c1e 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -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">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 6448e65bab..24912b846f 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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; 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; 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; 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 index 0000000000..b3b2a56218 --- /dev/null +++ b/test/Sema/return-silent.c @@ -0,0 +1,9 @@ +// RUN: clang-cc %s -Wno-return-type -fsyntax-only -verify + +int t14() { + return; +} + +void t15() { + return 1; +} diff --git a/test/Sema/return.c b/test/Sema/return.c index b32b2e9eeb..d96cede68a 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -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}} +} -- 2.40.0