]> granicus.if.org Git - clang/commitdiff
Add test case for PR 9774, which got fixed along the way.
authorTed Kremenek <kremenek@apple.com>
Tue, 3 Jan 2012 21:02:04 +0000 (21:02 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 3 Jan 2012 21:02:04 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147479 91177308-0d34-0410-b5e6-96231b3b80d8

test/Sema/warn-unreachable.c

index 8db36b710012dcea29e406f958069896675428e6..3ad53c707bae8ee31e2a26832bd88fb3cc8f5bca 100644 (file)
@@ -125,4 +125,10 @@ void test_assert() {
   return; // no-warning
 }
 
+// Test case for PR 9774.  Tests that dead code in macros aren't warned about.
+#define MY_MAX(a,b)     ((a) >= (b) ? (a) : (b))
+void PR9774(int *s) {
+    for (int i = 0; i < MY_MAX(2, 3); i++) // no-warning
+        s[i] = 0;
+}