[cfe-commits] r100810 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td test/Sema/warn-unused-parameters.c test/SemaObjC/unused.m
Ted Kremenek
kremenek at apple.com
Thu Apr 8 14:10:56 PDT 2010
Author: kremenek
Date: Thu Apr 8 16:10:56 2010
New Revision: 100810
URL: http://llvm.org/viewvc/llvm-project?rev=100810&view=rev
Log:
Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/test/Sema/warn-unused-parameters.c
cfe/trunk/test/SemaObjC/unused.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=100810&r1=100809&r2=100810&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Apr 8 16:10:56 2010
@@ -138,7 +138,8 @@
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]>;
Modified: cfe/trunk/test/Sema/warn-unused-parameters.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-unused-parameters.c?rev=100810&r1=100809&r2=100810&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-unused-parameters.c (original)
+++ cfe/trunk/test/Sema/warn-unused-parameters.c Thu Apr 8 16:10:56 2010
@@ -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
Modified: cfe/trunk/test/SemaObjC/unused.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/unused.m?rev=100810&r1=100809&r2=100810&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/unused.m (original)
+++ cfe/trunk/test/SemaObjC/unused.m Thu Apr 8 16:10:56 2010
@@ -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 *, ...);
More information about the cfe-commits
mailing list