From: Ted Kremenek Date: Thu, 8 Apr 2010 21:10:56 +0000 (+0000) Subject: Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4c0c2df7a40c753f2eddd8726f807877be4be07;p=clang Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100810 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 524856880b..1b2abfefd5 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -138,7 +138,8 @@ def Conversion : DiagGroup<"conversion", def Unused : DiagGroup<"unused", [UnusedArgument, UnusedFunction, UnusedLabel, - UnusedParameter, UnusedValue, UnusedVariable]>; + // UnusedParameter, (matches GCC's behavior) + UnusedValue, UnusedVariable]>; // Format settings. def Format : DiagGroup<"format", [FormatExtraArgs, FormatZeroLength, NonNull]>; diff --git a/test/Sema/warn-unused-parameters.c b/test/Sema/warn-unused-parameters.c index c6458cf971..43ebdbff2b 100644 --- a/test/Sema/warn-unused-parameters.c +++ b/test/Sema/warn-unused-parameters.c @@ -1,13 +1,22 @@ -// RUN: %clang -fblocks -fsyntax-only -Wunused-parameter %s -Xclang -verify +// RUN: %clang -fblocks -fsyntax-only -Wunused-parameter %s 2>&1 | FileCheck %s +// RUN: %clang -fblocks -fsyntax-only -Wunused %s 2>&1 | FileCheck -check-prefix=CHECK-unused %s int f0(int x, - int y, // expected-warning{{unused}} + int y, int z __attribute__((unused))) { return x; } void f1() { (void)^(int x, - int y, // expected-warning{{unused}} + int y, int z __attribute__((unused))) { return x; }; } + +// Used when testing '-Wunused' to see that we only emit one diagnostic, and no +// warnings for the above cases. +static void achor() {}; + +// CHECK: 5:12: warning: unused parameter 'y' +// CHECK: 12:15: warning: unused parameter 'y' +// CHECK-unused: 1 warning generated \ No newline at end of file diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m index a33a1bc02f..7e1b10433d 100644 --- a/test/SemaObjC/unused.m +++ b/test/SemaObjC/unused.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -verify -Wunused -fsyntax-only +// RUN: %clang_cc1 %s -verify -Wunused -Wunused-parameter -fsyntax-only int printf(const char *, ...);