]> granicus.if.org Git - clang/commitdiff
Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'.
authorTed Kremenek <kremenek@apple.com>
Thu, 8 Apr 2010 21:10:56 +0000 (21:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 8 Apr 2010 21:10:56 +0000 (21:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100810 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
test/Sema/warn-unused-parameters.c
test/SemaObjC/unused.m

index 524856880b994cb1a339373ae2ca9788627359f6..1b2abfefd58c67adec2de49fd4494e646f8f572e 100644 (file)
@@ -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]>;
index c6458cf9712bcb687ced717e7b8d1c315fb18798..43ebdbff2b36e293759a64c10a3039e14a3f2775 100644 (file)
@@ -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
index a33a1bc02f9dfeac6baf89f0b0b9868f1b163d07..7e1b10433dff90c8c5d5ed6ec0903ccbe7d205b2 100644 (file)
@@ -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 *, ...);