aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/FixIt/format-darwin.m23
-rw-r--r--test/Sema/format-strings-size_t.c2
2 files changed, 24 insertions, 1 deletions
diff --git a/test/FixIt/format-darwin.m b/test/FixIt/format-darwin.m
index cfaac29e90..0724e5760f 100644
--- a/test/FixIt/format-darwin.m
+++ b/test/FixIt/format-darwin.m
@@ -21,6 +21,7 @@ typedef int NSInteger;
typedef unsigned int NSUInteger;
typedef long SInt32;
typedef unsigned long UInt32;
+
#endif
NSInteger getNSInteger();
@@ -210,3 +211,25 @@ void testCapitals() {
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:13-[[@LINE-3]]:14}:"d"
// CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:11-[[@LINE-4]]:14}:"%D"
}
+
+
+// The OS X headers do not always use __INTMAX_TYPE__ and friends.
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
+#define INTMAX_C(X) (X ## LL)
+#define UINTMAX_C(X) (X ## ULL)
+
+void testIntMax(intmax_t i, uintmax_t u) {
+ printf("%d", i); // expected-warning{{format specifies type 'int' but the argument has type 'intmax_t' (aka 'long long')}}
+ printf("%d", u); // expected-warning{{format specifies type 'int' but the argument has type 'uintmax_t' (aka 'unsigned long long')}}
+
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:13}:"%jd"
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:11-[[@LINE-3]]:13}:"%ju"
+
+ printf("%jd", i); // no-warning
+ printf("%ju", u); // no-warning
+
+ printf("%jd", INTMAX_C(5)); // no-warning
+ printf("%ju", INTMAX_C(5)); // no-warning
+}
+
diff --git a/test/Sema/format-strings-size_t.c b/test/Sema/format-strings-size_t.c
index 5058a76218..5751f8885c 100644
--- a/test/Sema/format-strings-size_t.c
+++ b/test/Sema/format-strings-size_t.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
int printf(char const *, ...);