summaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/MicrosoftCompatibility-x64.c8
-rw-r--r--test/Sema/MicrosoftCompatibility-x86.c6
-rw-r--r--test/Sema/MicrosoftCompatibility.c2
-rw-r--r--test/Sema/PR2727.c1
-rw-r--r--test/Sema/PR2728.c1
-rw-r--r--test/Sema/PR2923.c1
-rw-r--r--test/Sema/address-constant.c1
-rw-r--r--test/Sema/align-arm-apcs.c1
-rw-r--r--test/Sema/align-x86-64.c1
-rw-r--r--test/Sema/align-x86.c1
-rw-r--r--test/Sema/arg-scope-c99.c1
-rw-r--r--test/Sema/arg-scope.c1
-rw-r--r--test/Sema/arm-layout.c1
-rw-r--r--test/Sema/array-init.c2
-rw-r--r--test/Sema/asm.c2
-rw-r--r--test/Sema/assign-null.c1
-rw-r--r--test/Sema/atomic-ops.c7
-rw-r--r--test/Sema/attr-availability-macosx.c6
-rw-r--r--test/Sema/attr-availability.c6
-rw-r--r--test/Sema/attr-minsize.c5
-rw-r--r--test/Sema/attr-used.c2
-rw-r--r--test/Sema/bitfield-layout.c1
-rw-r--r--test/Sema/bitfield-promote.c1
-rw-r--r--test/Sema/block-return.c2
-rw-r--r--test/Sema/block-storageclass.c1
-rw-r--r--test/Sema/builtin_objc_msgSend.c1
-rw-r--r--test/Sema/builtins-arm.c20
-rw-r--r--test/Sema/builtins-decl.c1
-rw-r--r--test/Sema/builtins.c16
-rw-r--r--test/Sema/c89-2.c5
-rw-r--r--test/Sema/c89.c6
-rw-r--r--test/Sema/callingconv.c8
-rw-r--r--test/Sema/cast-to-union.c6
-rw-r--r--test/Sema/cast.c15
-rw-r--r--test/Sema/check-increment.c1
-rw-r--r--test/Sema/compare.c32
-rw-r--r--test/Sema/complex-promotion.c1
-rw-r--r--test/Sema/compound-literal.c19
-rw-r--r--test/Sema/const-eval-64.c1
-rw-r--r--test/Sema/const-ptr-int-ptr-cast.c1
-rw-r--r--test/Sema/constant-builtins-2.c3
-rw-r--r--test/Sema/constant-builtins.c4
-rw-r--r--test/Sema/darwin-align-cast.c1
-rw-r--r--test/Sema/enum-packed.c1
-rw-r--r--test/Sema/expr-comma-c99.c1
-rw-r--r--test/Sema/expr-comma.c1
-rw-r--r--test/Sema/exprs.c2
-rw-r--r--test/Sema/format-string-percentm.c1
-rw-r--r--test/Sema/format-strings-darwin.c64
-rw-r--r--test/Sema/format-strings-gnu.c55
-rw-r--r--test/Sema/format-strings-non-iso.c16
-rw-r--r--test/Sema/format-strings-scanf.c16
-rw-r--r--test/Sema/format-strings.c12
-rw-r--r--test/Sema/function-redecl.c4
-rw-r--r--test/Sema/heinous-extensions-on.c4
-rw-r--r--test/Sema/i-c-e.c2
-rw-r--r--test/Sema/implicit-builtin-freestanding.c1
-rw-r--r--test/Sema/init-struct-qualified.c1
-rw-r--r--test/Sema/init-vector.c1
-rw-r--r--test/Sema/int-arith-convert.c1
-rw-r--r--test/Sema/invalid-decl.c9
-rw-r--r--test/Sema/knr-variadic-def.c1
-rw-r--r--test/Sema/many-logical-ops.c1
-rw-r--r--test/Sema/member-reference.c1
-rw-r--r--test/Sema/mms-bitfields.c13
-rw-r--r--test/Sema/ms-inline-asm.c35
-rw-r--r--test/Sema/ms_wide_predefined_expr.cpp1
-rw-r--r--test/Sema/no-format-y2k-turnsoff-format.c2
-rw-r--r--test/Sema/outof-range-constant-compare.c149
-rw-r--r--test/Sema/overloaded-func-transparent-union.c1
-rw-r--r--test/Sema/parentheses.c6
-rw-r--r--test/Sema/parentheses.cpp12
-rw-r--r--test/Sema/pragma-align-mac68k.c13
-rw-r--r--test/Sema/pragma-align-packed.c1
-rw-r--r--test/Sema/pragma-ms_struct.c6
-rw-r--r--test/Sema/pragma-pack-2.c1
-rw-r--r--test/Sema/pragma-pack-3.c1
-rw-r--r--test/Sema/pragma-pack-4.c1
-rw-r--r--test/Sema/pragma-pack-5.c1
-rw-r--r--test/Sema/pragma-pack-6.c1
-rw-r--r--test/Sema/pragma-pack-and-options-align.c11
-rw-r--r--test/Sema/private-extern.c2
-rw-r--r--test/Sema/return-silent.c1
-rw-r--r--test/Sema/short-enums.c1
-rw-r--r--test/Sema/stdcall-fastcall-x64.c20
-rw-r--r--test/Sema/stdcall-fastcall.c1
-rw-r--r--test/Sema/struct-cast.c1
-rw-r--r--test/Sema/struct-packed-align.c1
-rw-r--r--test/Sema/surpress-deprecated.c1
-rw-r--r--test/Sema/template-specialization.cpp21
-rw-r--r--test/Sema/tentative-decls.c3
-rw-r--r--test/Sema/thread-specifier.c9
-rw-r--r--test/Sema/tls.c3
-rw-r--r--test/Sema/transparent-union-pointer.c1
-rw-r--r--test/Sema/typedef-prototype.c1
-rw-r--r--test/Sema/types.c2
-rw-r--r--test/Sema/uninit-variables.c23
-rw-r--r--test/Sema/unnamed-bitfield-init.c1
-rw-r--r--test/Sema/unused-expr.c11
-rw-r--r--test/Sema/va_arg_x86_64.c1
-rw-r--r--test/Sema/variadic-block.c1
-rw-r--r--test/Sema/vector-cast.c12
-rw-r--r--test/Sema/vfprintf-valid-redecl.c1
-rw-r--r--test/Sema/warn-bad-function-cast.c47
-rw-r--r--test/Sema/warn-documentation-fixits.cpp44
-rw-r--r--test/Sema/warn-documentation.cpp136
-rw-r--r--test/Sema/warn-documentation.m8
-rw-r--r--test/Sema/warn-gnu-designators.c1
-rw-r--r--test/Sema/warn-missing-variable-declarations.c18
-rw-r--r--test/Sema/warn-type-safety-mpi-hdf5.c4
-rw-r--r--test/Sema/warn-type-safety.c8
-rw-r--r--test/Sema/warn-type-safety.cpp4
-rw-r--r--test/Sema/warn-unreachable.c9
-rw-r--r--test/Sema/warn-unused-function.c14
-rw-r--r--test/Sema/wchar.c2
-rw-r--r--test/Sema/weak-import-on-enum.c1
116 files changed, 954 insertions, 113 deletions
diff --git a/test/Sema/MicrosoftCompatibility-x64.c b/test/Sema/MicrosoftCompatibility-x64.c
new file mode 100644
index 000000000000..bf595af69939
--- /dev/null
+++ b/test/Sema/MicrosoftCompatibility-x64.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-compatibility -triple x86_64-pc-win32
+int __stdcall f(void); /* expected-warning {{calling convention '__stdcall' ignored for this target}} */
+
+/* This should compile without warning because __stdcall is treated
+as __cdecl in MS compatibility mode for x64 compiles*/
+int __cdecl f(void) {
+ return 0;
+}
diff --git a/test/Sema/MicrosoftCompatibility-x86.c b/test/Sema/MicrosoftCompatibility-x86.c
new file mode 100644
index 000000000000..1e3762b3788f
--- /dev/null
+++ b/test/Sema/MicrosoftCompatibility-x86.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-compatibility -triple i386-pc-win32
+int __stdcall f(void); /* expected-note {{previous declaration is here}} */
+
+int __cdecl f(void) { /* expected-error {{function declared 'cdecl' here was previously declared 'stdcall'}} */
+ return 0;
+}
diff --git a/test/Sema/MicrosoftCompatibility.c b/test/Sema/MicrosoftCompatibility.c
index 6b137a60c4f0..6330c1566703 100644
--- a/test/Sema/MicrosoftCompatibility.c
+++ b/test/Sema/MicrosoftCompatibility.c
@@ -18,4 +18,4 @@ __declspec(noreturn) void f6( void ) {
__declspec(align(32768)) struct S1 { int a; } s; /* expected-error {{requested alignment must be 8192 bytes or smaller}} */
struct __declspec(aligned) S2 {}; /* expected-warning {{unknown __declspec attribute 'aligned' ignored}} */
-struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */ \ No newline at end of file
+struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */
diff --git a/test/Sema/PR2727.c b/test/Sema/PR2727.c
index 332b0df72835..11282fdea8a4 100644
--- a/test/Sema/PR2727.c
+++ b/test/Sema/PR2727.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -verify -fsyntax-only -std=c90 %s
// RUN: %clang_cc1 -verify -fsyntax-only -std=c99 %s
+// expected-no-diagnostics
int f (int x)
{
diff --git a/test/Sema/PR2728.c b/test/Sema/PR2728.c
index e9f1deaf7cd6..0c994057a1e4 100644
--- a/test/Sema/PR2728.c
+++ b/test/Sema/PR2728.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -verify -fsyntax-only -std=c90 %s
// RUN: %clang_cc1 -verify -fsyntax-only -std=c99 %s
+// expected-no-diagnostics
struct s
{
diff --git a/test/Sema/PR2923.c b/test/Sema/PR2923.c
index f22e70dd8d3d..5741de8e38ec 100644
--- a/test/Sema/PR2923.c
+++ b/test/Sema/PR2923.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// Test for absence of crash reported in PR 2923:
//
diff --git a/test/Sema/address-constant.c b/test/Sema/address-constant.c
index e842a7396b8d..c13485b37ba5 100644
--- a/test/Sema/address-constant.c
+++ b/test/Sema/address-constant.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
int i;
int a[] = {0};
diff --git a/test/Sema/align-arm-apcs.c b/test/Sema/align-arm-apcs.c
index 0a5d3fe92151..544f53923191 100644
--- a/test/Sema/align-arm-apcs.c
+++ b/test/Sema/align-arm-apcs.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple arm-unknown-unknown -target-abi apcs-gnu -fsyntax-only -verify %s
+// expected-no-diagnostics
struct s0 { double f0; int f1; };
char chk0[__alignof__(struct s0) == 4 ? 1 : -1];
diff --git a/test/Sema/align-x86-64.c b/test/Sema/align-x86-64.c
index edea5d8b7422..09bf63390f35 100644
--- a/test/Sema/align-x86-64.c
+++ b/test/Sema/align-x86-64.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
+// expected-no-diagnostics
// PR5599
diff --git a/test/Sema/align-x86.c b/test/Sema/align-x86.c
index c6cd7543c21d..6b93a4893d15 100644
--- a/test/Sema/align-x86.c
+++ b/test/Sema/align-x86.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
// PR3433
double g1;
diff --git a/test/Sema/arg-scope-c99.c b/test/Sema/arg-scope-c99.c
index 912776ab8ff6..9b2811ccc759 100644
--- a/test/Sema/arg-scope-c99.c
+++ b/test/Sema/arg-scope-c99.c
@@ -1,2 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -std=c99 -verify %s
+// expected-no-diagnostics
void bb(int sz, int ar[sz][sz]) { }
diff --git a/test/Sema/arg-scope.c b/test/Sema/arg-scope.c
index ed9261941b58..3de672be9f7d 100644
--- a/test/Sema/arg-scope.c
+++ b/test/Sema/arg-scope.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
void aa(int b, int x[sizeof b]) {}
void foo(int i, int A[i]) {}
diff --git a/test/Sema/arm-layout.c b/test/Sema/arm-layout.c
index d017fdb8aa07..4b76515d6257 100644
--- a/test/Sema/arm-layout.c
+++ b/test/Sema/arm-layout.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi apcs-gnu %s -verify
// RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi aapcs %s -verify
+// expected-no-diagnostics
#define check(name, cond) int _##name##_check[(cond) ? 1 : -1]
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index cfdf8e2bd7ca..b3cae60495c7 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wgnu -Wc11-extensions -verify %s
+// REQUIRES: LP64
extern int foof() = 1; // expected-error{{illegal initializer (only variables can be initialized)}}
diff --git a/test/Sema/asm.c b/test/Sema/asm.c
index 44d83e92143b..155d736b9956 100644
--- a/test/Sema/asm.c
+++ b/test/Sema/asm.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple i386-pc-linux-gnu -verify -fsyntax-only
+// RUN: %clang_cc1 %s -Wno-private-extern -triple i386-pc-linux-gnu -verify -fsyntax-only
void f() {
int i;
diff --git a/test/Sema/assign-null.c b/test/Sema/assign-null.c
index 7f172b195355..ac90850eb7ce 100644
--- a/test/Sema/assign-null.c
+++ b/test/Sema/assign-null.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#include <stddef.h>
diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c
index f769271631ba..2a935918ac08 100644
--- a/test/Sema/atomic-ops.c
+++ b/test/Sema/atomic-ops.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple=i686-linux-gnu -std=c11
// Basic parsing/Sema tests for __c11_atomic_*
@@ -162,4 +162,9 @@ void f(_Atomic(int) *i, _Atomic(int*) *p, _Atomic(float) *d,
__atomic_clear(&flag_k, memory_order_seq_cst); // expected-warning {{passing 'const volatile int *' to parameter of type 'volatile void *'}}
__atomic_clear(&flag, memory_order_seq_cst);
(int)__atomic_clear(&flag, memory_order_seq_cst); // expected-error {{operand of type 'void'}}
+
+ const _Atomic(int) const_atomic;
+ __c11_atomic_init(&const_atomic, 0); // expected-error {{first argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
+ __c11_atomic_store(&const_atomic, 0, memory_order_release); // expected-error {{first argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
+ __c11_atomic_load(&const_atomic, memory_order_acquire); // expected-error {{first argument to atomic operation must be a pointer to non-const _Atomic type ('const _Atomic(int) *' invalid)}}
}
diff --git a/test/Sema/attr-availability-macosx.c b/test/Sema/attr-availability-macosx.c
index 781523a2e06a..468e9303e70d 100644
--- a/test/Sema/attr-availability-macosx.c
+++ b/test/Sema/attr-availability-macosx.c
@@ -10,10 +10,10 @@ void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macos
void test() {
f0(0);
f1(0);
- f2(0); // expected-warning{{'f2' is deprecated: first deprecated in Mac OS X 10.5}}
+ f2(0); // expected-warning{{'f2' is deprecated: first deprecated in OS X 10.5}}
f3(0);
- f4(0); // expected-error{{f4' is unavailable: obsoleted in Mac OS X 10.5}}
- f5(0); // expected-error{{'f5' is unavailable: not available on Mac OS X}}
+ f4(0); // expected-error{{f4' is unavailable: obsoleted in OS X 10.5}}
+ f5(0); // expected-error{{'f5' is unavailable: not available on OS X}}
}
// rdar://10535640
diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c
index b4a6f9616df4..e0c541e8d839 100644
--- a/test/Sema/attr-availability.c
+++ b/test/Sema/attr-availability.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify %s
-void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
+void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0))); // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}
void f2() __attribute__((availability(ios,introduced=2.1,deprecated=2.1)));
@@ -14,8 +14,8 @@ extern void
ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{function has been explicitly marked unavailable here}}
void test_10095131() {
- ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in Mac OS X 9.0 - use CTFontCopyFullName}}
- ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in Mac OS X 9.0 - use ATSFontGetFullPostScriptName}}
+ ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in OS X 9.0 - use CTFontCopyFullName}}
+ ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in OS X 9.0 - use ATSFontGetFullPostScriptName}}
}
// rdar://10711037
diff --git a/test/Sema/attr-minsize.c b/test/Sema/attr-minsize.c
new file mode 100644
index 000000000000..7b1c6ae66f1b
--- /dev/null
+++ b/test/Sema/attr-minsize.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int foo() __attribute__((__minsize__));
+
+int var1 __attribute__((__minsize__)); // expected-error{{'__minsize__' attribute only applies to functions and methods}}
diff --git a/test/Sema/attr-used.c b/test/Sema/attr-used.c
index 08388169247e..e2dfab141a99 100644
--- a/test/Sema/attr-used.c
+++ b/test/Sema/attr-used.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
diff --git a/test/Sema/bitfield-layout.c b/test/Sema/bitfield-layout.c
index 2655fc70cd4c..d22639147586 100644
--- a/test/Sema/bitfield-layout.c
+++ b/test/Sema/bitfield-layout.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-apple-darwin9
+// expected-no-diagnostics
#define CHECK_SIZE(kind, name, size) extern int name##1[sizeof(kind name) == size ? 1 : -1];
#define CHECK_ALIGN(kind, name, size) extern int name##2[__alignof(kind name) == size ? 1 : -1];
diff --git a/test/Sema/bitfield-promote.c b/test/Sema/bitfield-promote.c
index 4d14ad191e1e..3189cd57e4f3 100644
--- a/test/Sema/bitfield-promote.c
+++ b/test/Sema/bitfield-promote.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
struct {unsigned x : 2;} x;
__typeof__((x.x+=1)+1) y;
__typeof__(x.x<<1) y;
diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c
index 6967955b0878..2ea4d813ab01 100644
--- a/test/Sema/block-return.c
+++ b/test/Sema/block-return.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -pedantic -fsyntax-only %s -verify -fblocks
+// RUN: %clang_cc1 -Wno-int-to-pointer-cast -pedantic -fsyntax-only %s -verify -fblocks
typedef void (^CL)(void);
diff --git a/test/Sema/block-storageclass.c b/test/Sema/block-storageclass.c
index 9bfbfbd614e5..74f1b0ea77fa 100644
--- a/test/Sema/block-storageclass.c
+++ b/test/Sema/block-storageclass.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
+// expected-no-diagnostics
int printf(const char *, ...);
void _Block_byref_release(void*src){}
diff --git a/test/Sema/builtin_objc_msgSend.c b/test/Sema/builtin_objc_msgSend.c
index 357a5bc26eb5..419e92da44eb 100644
--- a/test/Sema/builtin_objc_msgSend.c
+++ b/test/Sema/builtin_objc_msgSend.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar://8632525
typedef struct objc_class *Class;
diff --git a/test/Sema/builtins-arm.c b/test/Sema/builtins-arm.c
index 4077240ce490..7b48af155ee8 100644
--- a/test/Sema/builtins-arm.c
+++ b/test/Sema/builtins-arm.c
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify -DTEST0 %s
// RUN: %clang_cc1 -triple armv7 -fsyntax-only -verify -DTEST1 %s
+// RUN: %clang_cc1 -triple armv7 -target-abi apcs-gnu \
+// RUN: -fsyntax-only -verify -DTEST1 %s
#ifdef TEST0
void __clear_cache(char*, char*);
@@ -9,8 +11,24 @@ void __clear_cache(char*, char*);
void __clear_cache(void*, void*);
#endif
-// va_list on ARM is void*.
+#if defined(__ARM_PCS) || defined(__ARM_EABI__)
+// va_list on ARM AAPCS is struct { void* __ap }.
+void test1() {
+ __builtin_va_list ptr;
+ ptr.__ap = "x";
+ *(ptr.__ap) = '0'; // expected-error {{incomplete type 'void' is not assignable}}
+}
+#else
+// va_list on ARM apcs-gnu is void*.
+void test1() {
+ __builtin_va_list ptr;
+ ptr.__ap = "x"; // expected-error {{member reference base type '__builtin_va_list' is not a structure or union}}
+ *(ptr.__ap) = '0';// expected-error {{member reference base type '__builtin_va_list' is not a structure or union}}
+}
+
void test2() {
__builtin_va_list ptr = "x";
*ptr = '0'; // expected-error {{incomplete type 'void' is not assignable}}
}
+
+#endif
diff --git a/test/Sema/builtins-decl.c b/test/Sema/builtins-decl.c
index d6b004aa8820..729dc4599de9 100644
--- a/test/Sema/builtins-decl.c
+++ b/test/Sema/builtins-decl.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-mingw32
// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-mingw32
+// expected-no-diagnostics
// mingw-w64's intrin.h has decls below.
// we should accept them.
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index b8b03677fdae..e3b3b7e83178 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -40,7 +40,7 @@ void test9(short v) {
old = __sync_fetch_and_add(); // expected-error {{too few arguments to function call}}
old = __sync_fetch_and_add(&old); // expected-error {{too few arguments to function call}}
- old = __sync_fetch_and_add((unsigned*)0, 42i); // expected-warning {{imaginary constants are an extension}}
+ old = __sync_fetch_and_add((unsigned*)0, 42i); // expected-warning {{imaginary constants are a GNU extension}}
// PR7600: Pointers are implicitly casted to integers and back.
void *old_ptr = __sync_val_compare_and_swap((void**)0, 0, 0);
@@ -51,6 +51,20 @@ void test9(short v) {
}
}
+// overloaded atomics should be declared only once.
+void test9_1(volatile int* ptr, int val) {
+ __sync_fetch_and_add_4(ptr, val);
+}
+void test9_2(volatile int* ptr, int val) {
+ __sync_fetch_and_add(ptr, val);
+}
+void test9_3(volatile int* ptr, int val) {
+ __sync_fetch_and_add_4(ptr, val);
+ __sync_fetch_and_add(ptr, val);
+ __sync_fetch_and_add(ptr, val);
+ __sync_fetch_and_add_4(ptr, val);
+ __sync_fetch_and_add_4(ptr, val);
+}
// rdar://7236819
void test10(void) __attribute__((noreturn));
diff --git a/test/Sema/c89-2.c b/test/Sema/c89-2.c
deleted file mode 100644
index 14b955a6a4b3..000000000000
--- a/test/Sema/c89-2.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* RUN: %clang_cc1 %s -std=c89 -pedantic-errors -Wno-empty-translation-unit -verify
- */
-
-#if 1LL /* expected-error {{long long}} */
-#endif
diff --git a/test/Sema/c89.c b/test/Sema/c89.c
index 110d7e137621..a410a626edac 100644
--- a/test/Sema/c89.c
+++ b/test/Sema/c89.c
@@ -110,3 +110,9 @@ typedef CI *array_of_pointer_to_CI[5];
const array_of_pointer_to_CI mine3;
void main() {} /* expected-error {{'main' must return 'int'}} */
+
+long long ll1 = /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */
+ -42LL; /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */
+unsigned long long ull1 = /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */
+ 42ULL; /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */
+
diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c
index 6c844a373318..266242d4a3a9 100644
--- a/test/Sema/callingconv.c
+++ b/test/Sema/callingconv.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -verify
void __attribute__((fastcall)) foo(float *a) {
}
@@ -40,8 +40,9 @@ int __attribute__((pcs("aapcs", "aapcs"))) pcs1(void); // expected-error {{attri
int __attribute__((pcs())) pcs2(void); // expected-error {{attribute takes one argument}}
int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{attribute takes one argument}}
int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires parameter 1 to be a string}}
-int __attribute__((pcs("aapcs"))) pcs5(void); // no-error
-int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // no-error
+/* These are ignored because the target is i386 and not ARM */
+int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
+int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}
int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{Invalid PCS type}}
// PR6361
@@ -52,3 +53,4 @@ void __attribute__((cdecl)) ctest3() {}
typedef __attribute__((stdcall)) void (*PROC)();
PROC __attribute__((cdecl)) ctest4(const char *x) {}
+void __attribute__((pnaclcall)) pnaclfunc(float *a) {} // expected-warning {{calling convention 'pnaclcall' ignored for this target}}
diff --git a/test/Sema/cast-to-union.c b/test/Sema/cast-to-union.c
index c32964dfc0d5..7b995e3d0cb8 100644
--- a/test/Sema/cast-to-union.c
+++ b/test/Sema/cast-to-union.c
@@ -4,16 +4,16 @@ union u { int i; unsigned : 3; };
void f(union u);
void test(int x) {
- f((union u)x); // expected-warning {{C99 forbids casts to union type}}
+ f((union u)x); // expected-warning {{cast to union type is a GNU extension}}
f((union u)&x); // expected-error {{cast to union type from type 'int *' not present in union}}
f((union u)2U); // expected-error {{cast to union type from type 'unsigned int' not present in union}}
}
-union u w = (union u)2; // expected-warning {{C99 forbids casts to union type}}
+union u w = (union u)2; // expected-warning {{cast to union type is a GNU extension}}
union u ww = (union u)1.0; // expected-error{{cast to union type from type 'double' not present in union}}
union u x = 7; // expected-error{{initializing 'union u' with an expression of incompatible type 'int'}}
int i;
-union u zz = (union u)i; // expected-error{{initializer element is not a compile-time constant}} expected-warning {{C99 forbids casts to union type}}
+union u zz = (union u)i; // expected-error{{initializer element is not a compile-time constant}} expected-warning {{cast to union type is a GNU extension}}
struct s {int a, b;};
struct s y = { 1, 5 };
diff --git a/test/Sema/cast.c b/test/Sema/cast.c
index 71c44b4b816b..25ef1d03a4fe 100644
--- a/test/Sema/cast.c
+++ b/test/Sema/cast.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown %s -verify
typedef struct { unsigned long bits[(((1) + (64) - 1) / (64))]; } cpumask_t;
cpumask_t x;
@@ -52,8 +52,8 @@ void testInt(Int v) {
(void) (CLong) v;
(void) (CFloat) v;
(void) (CDouble) v;
- (void) (VoidPtr) v;
- (void) (CharPtr) v;
+ (void) (VoidPtr) v; // expected-warning{{cast to 'VoidPtr' (aka 'void *') from smaller integer type 'Int' (aka 'int')}}
+ (void) (CharPtr) v; // expected-warning{{cast to 'CharPtr' (aka 'char *') from smaller integer type 'Int' (aka 'int')}}
}
void testLong(Long v) {
@@ -157,3 +157,12 @@ void testCharPtr(CharPtr v) {
(void) (VoidPtr) v;
(void) (CharPtr) v;
}
+
+typedef enum { x_a, x_b } X;
+void *intToPointerCast2(X x) {
+ return (void*)x;
+}
+
+void *intToPointerCast3() {
+ return (void*)(1 + 3);
+}
diff --git a/test/Sema/check-increment.c b/test/Sema/check-increment.c
index 070ea74f6800..ae33c2085666 100644
--- a/test/Sema/check-increment.c
+++ b/test/Sema/check-increment.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
int printf(const char *, ...);
typedef int *pint;
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 406ade81aa0d..b5d4ef5d12ca 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -93,8 +93,8 @@ int ints(long a, unsigned long b) {
// (C,b)
(C == (unsigned long) b) +
(C == (unsigned int) b) +
- (C == (unsigned short) b) +
- (C == (unsigned char) b) +
+ (C == (unsigned short) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned short' is always false}}
+ (C == (unsigned char) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned char' is always false}}
((long) C == b) +
((int) C == b) +
((short) C == b) +
@@ -105,8 +105,8 @@ int ints(long a, unsigned long b) {
((signed char) C == (unsigned char) b) +
(C < (unsigned long) b) +
(C < (unsigned int) b) +
- (C < (unsigned short) b) +
- (C < (unsigned char) b) +
+ (C < (unsigned short) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned short' is always false}}
+ (C < (unsigned char) b) + // expected-warning {{comparison of constant 65536 with expression of type 'unsigned char' is always false}}
((long) C < b) +
((int) C < b) +
((short) C < b) +
@@ -123,8 +123,8 @@ int ints(long a, unsigned long b) {
(a == (unsigned char) C) +
((long) a == C) +
((int) a == C) +
- ((short) a == C) +
- ((signed char) a == C) +
+ ((short) a == C) + // expected-warning {{comparison of constant 65536 with expression of type 'short' is always false}}
+ ((signed char) a == C) + // expected-warning {{comparison of constant 65536 with expression of type 'signed char' is always false}}
((long) a == (unsigned long) C) +
((int) a == (unsigned int) C) +
((short) a == (unsigned short) C) +
@@ -135,8 +135,8 @@ int ints(long a, unsigned long b) {
(a < (unsigned char) C) +
((long) a < C) +
((int) a < C) +
- ((short) a < C) +
- ((signed char) a < C) +
+ ((short) a < C) + // expected-warning {{comparison of constant 65536 with expression of type 'short' is always true}}
+ ((signed char) a < C) + // expected-warning {{comparison of constant 65536 with expression of type 'signed char' is always true}}
((long) a < (unsigned long) C) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) C) + // expected-warning {{comparison of integers of different signs}}
((short) a < (unsigned short) C) +
@@ -145,8 +145,8 @@ int ints(long a, unsigned long b) {
// (0x80000,b)
(0x80000 == (unsigned long) b) +
(0x80000 == (unsigned int) b) +
- (0x80000 == (unsigned short) b) +
- (0x80000 == (unsigned char) b) +
+ (0x80000 == (unsigned short) b) + // expected-warning {{comparison of constant 524288 with expression of type 'unsigned short' is always false}}
+ (0x80000 == (unsigned char) b) + // expected-warning {{comparison of constant 524288 with expression of type 'unsigned char' is always false}}
((long) 0x80000 == b) +
((int) 0x80000 == b) +
((short) 0x80000 == b) +
@@ -157,8 +157,8 @@ int ints(long a, unsigned long b) {
((signed char) 0x80000 == (unsigned char) b) +
(0x80000 < (unsigned long) b) +
(0x80000 < (unsigned int) b) +
- (0x80000 < (unsigned short) b) +
- (0x80000 < (unsigned char) b) +
+ (0x80000 < (unsigned short) b) + // expected-warning {{comparison of constant 524288 with expression of type 'unsigned short' is always false}}
+ (0x80000 < (unsigned char) b) + // expected-warning {{comparison of constant 524288 with expression of type 'unsigned char' is always false}}
((long) 0x80000 < b) +
((int) 0x80000 < b) +
((short) 0x80000 < b) +
@@ -175,8 +175,8 @@ int ints(long a, unsigned long b) {
(a == (unsigned char) 0x80000) +
((long) a == 0x80000) +
((int) a == 0x80000) +
- ((short) a == 0x80000) +
- ((signed char) a == 0x80000) +
+ ((short) a == 0x80000) + // expected-warning {{comparison of constant 524288 with expression of type 'short' is always false}}
+ ((signed char) a == 0x80000) + // expected-warning {{comparison of constant 524288 with expression of type 'signed char' is always false}}
((long) a == (unsigned long) 0x80000) +
((int) a == (unsigned int) 0x80000) +
((short) a == (unsigned short) 0x80000) +
@@ -187,8 +187,8 @@ int ints(long a, unsigned long b) {
(a < (unsigned char) 0x80000) +
((long) a < 0x80000) +
((int) a < 0x80000) +
- ((short) a < 0x80000) +
- ((signed char) a < 0x80000) +
+ ((short) a < 0x80000) + // expected-warning {{comparison of constant 524288 with expression of type 'short' is always true}}
+ ((signed char) a < 0x80000) + // expected-warning {{comparison of constant 524288 with expression of type 'signed char' is always true}}
((long) a < (unsigned long) 0x80000) + // expected-warning {{comparison of integers of different signs}}
((int) a < (unsigned int) 0x80000) + // expected-warning {{comparison of integers of different signs}}
((short) a < (unsigned short) 0x80000) +
diff --git a/test/Sema/complex-promotion.c b/test/Sema/complex-promotion.c
index 23c3b6895314..a59bf718931b 100644
--- a/test/Sema/complex-promotion.c
+++ b/test/Sema/complex-promotion.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
+// expected-no-diagnostics
float a;
diff --git a/test/Sema/compound-literal.c b/test/Sema/compound-literal.c
index beec6ca66e8f..c5c0c17143fa 100644
--- a/test/Sema/compound-literal.c
+++ b/test/Sema/compound-literal.c
@@ -1,19 +1,20 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// REQUIRES: LP64
struct foo { int a, b; };
static struct foo t = (struct foo){0,0};
static struct foo t1 = __builtin_choose_expr(0, (struct foo){0,0}, (struct foo){0,0});
static struct foo t2 = {0,0};
-static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
+static struct foo t3 = t2; // expected-error {{initializer element is not a compile-time constant}}
static int *p = (int []){2,4};
static int x = (int){1};
-static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
-static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
+static int *p2 = (int []){2,x}; // expected-error {{initializer element is not a compile-time constant}}
+static long *p3 = (long []){2,"x"}; // expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
-typedef struct { } cache_t; // -expected-warning{{empty struct is a GNU extension}}
-static cache_t clo_I1_cache = ((cache_t) { } ); // -expected-warning{{use of GNU empty initializer extension}}
+typedef struct { } cache_t; // expected-warning{{empty struct is a GNU extension}}
+static cache_t clo_I1_cache = ((cache_t) { } ); // expected-warning{{use of GNU empty initializer extension}}
typedef struct Test {int a;int b;} Test;
static Test* ll = &(Test) {0,0};
@@ -26,11 +27,11 @@ int main(int argc, char **argv) {
}
struct Incomplete; // expected-note{{forward declaration of 'struct Incomplete'}}
-struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // -expected-error {{variable has incomplete type}}
+struct Incomplete* I1 = &(struct Incomplete){1, 2, 3}; // expected-error {{variable has incomplete type}}
void IncompleteFunc(unsigned x) {
- struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // -expected-error {{variable-sized object may not be initialized}}
- (void){1,2,3}; // -expected-error {{variable has incomplete type}}
- (void(void)) { 0 }; // -expected-error{{illegal initializer type 'void (void)'}}
+ struct Incomplete* I2 = (struct foo[x]){1, 2, 3}; // expected-error {{variable-sized object may not be initialized}}
+ (void){1,2,3}; // expected-error {{variable has incomplete type}}
+ (void(void)) { 0 }; // expected-error{{illegal initializer type 'void (void)'}}
}
// PR6080
diff --git a/test/Sema/const-eval-64.c b/test/Sema/const-eval-64.c
index 5727a93e51fa..1290bf4dd85d 100644
--- a/test/Sema/const-eval-64.c
+++ b/test/Sema/const-eval-64.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-linux %s
+// expected-no-diagnostics
#define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});
diff --git a/test/Sema/const-ptr-int-ptr-cast.c b/test/Sema/const-ptr-int-ptr-cast.c
index 8beaf9d4947c..73b4a8a74fd0 100644
--- a/test/Sema/const-ptr-int-ptr-cast.c
+++ b/test/Sema/const-ptr-int-ptr-cast.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
+// expected-no-diagnostics
#include <stdint.h>
diff --git a/test/Sema/constant-builtins-2.c b/test/Sema/constant-builtins-2.c
index 68b46bf19ad9..13d81fe13cbf 100644
--- a/test/Sema/constant-builtins-2.c
+++ b/test/Sema/constant-builtins-2.c
@@ -48,6 +48,9 @@ extern int f();
int h0 = __builtin_types_compatible_p(int, float);
//int h1 = __builtin_choose_expr(1, 10, f());
//int h2 = __builtin_expect(0, 0);
+int h3 = __builtin_bswap16(0x1234) == 0x3412 ? 1 : f();
+int h4 = __builtin_bswap32(0x1234) == 0x34120000 ? 1 : f();
+int h5 = __builtin_bswap64(0x1234) == 0x3412000000000000 ? 1 : f();
extern long int bi0;
extern __typeof__(__builtin_expect(0, 0)) bi0;
diff --git a/test/Sema/constant-builtins.c b/test/Sema/constant-builtins.c
index 5d67fc7cb717..c98f62dfc5a2 100644
--- a/test/Sema/constant-builtins.c
+++ b/test/Sema/constant-builtins.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
+// expected-no-diagnostics
// Math stuff
@@ -16,6 +17,9 @@ extern int f();
int h0 = __builtin_types_compatible_p(int,float);
//int h1 = __builtin_choose_expr(1, 10, f());
//int h2 = __builtin_expect(0, 0);
+int h3 = __builtin_bswap16(0x1234) == 0x3412 ? 1 : f();
+int h4 = __builtin_bswap32(0x1234) == 0x34120000 ? 1 : f();
+int h5 = __builtin_bswap64(0x1234) == 0x3412000000000000 ? 1 : f();
short somefunc();
diff --git a/test/Sema/darwin-align-cast.c b/test/Sema/darwin-align-cast.c
index 208097481cdc..bd357edceddf 100644
--- a/test/Sema/darwin-align-cast.c
+++ b/test/Sema/darwin-align-cast.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef long unsigned int __darwin_size_t;
typedef long __darwin_ssize_t;
typedef __darwin_size_t size_t;
diff --git a/test/Sema/enum-packed.c b/test/Sema/enum-packed.c
index 0eb6c14dbe85..b6ba972ed686 100644
--- a/test/Sema/enum-packed.c
+++ b/test/Sema/enum-packed.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// PR7477
enum __attribute__((packed)) E {
diff --git a/test/Sema/expr-comma-c99.c b/test/Sema/expr-comma-c99.c
index d0883ba202f9..6e97a4fc4957 100644
--- a/test/Sema/expr-comma-c99.c
+++ b/test/Sema/expr-comma-c99.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c99
+// expected-no-diagnostics
// rdar://6095180
struct s { char c[17]; };
diff --git a/test/Sema/expr-comma.c b/test/Sema/expr-comma.c
index d3e4020af637..7902715915a2 100644
--- a/test/Sema/expr-comma.c
+++ b/test/Sema/expr-comma.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c89
+// expected-no-diagnostics
// rdar://6095180
struct s { char c[17]; };
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index a93e12ec390b..df3e25857c40 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -40,7 +40,7 @@ _Complex double test1() {
}
_Complex double test2() {
- return 1.0if; // expected-warning {{imaginary constants are an extension}}
+ return 1.0if; // expected-warning {{imaginary constants are a GNU extension}}
}
// rdar://6097308
diff --git a/test/Sema/format-string-percentm.c b/test/Sema/format-string-percentm.c
index 1ffc439af07a..02fea462946c 100644
--- a/test/Sema/format-string-percentm.c
+++ b/test/Sema/format-string-percentm.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -triple i686-pc-linux-gnu
+// expected-no-diagnostics
// PR 4142 - support glibc extension to printf: '%m' (which prints strerror(errno)).
int printf(char const*,...);
diff --git a/test/Sema/format-strings-darwin.c b/test/Sema/format-strings-darwin.c
new file mode 100644
index 000000000000..5daf3e5c8b67
--- /dev/null
+++ b/test/Sema/format-strings-darwin.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -pedantic -DALLOWED %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple thumbv6-apple-ios4.0 -pedantic -DALLOWED %s
+
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-mingw32 -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-pc-win32 -pedantic %s
+
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-freebsd -pedantic %s
+
+int printf(const char *restrict, ...);
+int scanf(const char * restrict, ...) ;
+
+void test() {
+ int justRight = 1;
+ long tooLong = 2;
+
+ printf("%D", justRight);
+ printf("%D", tooLong);
+ printf("%U", justRight);
+ printf("%U", tooLong);
+ printf("%O", justRight);
+ printf("%O", tooLong);
+
+#ifdef ALLOWED
+ // expected-warning@-8 {{'D' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'd'?}}
+ // expected-warning@-8 {{'D' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'd'?}} expected-warning@-8 {{format specifies type 'int' but the argument has type 'long'}}
+ // expected-warning@-8 {{'U' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'u'?}}
+ // expected-warning@-8 {{'U' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'u'?}} expected-warning@-8 {{format specifies type 'unsigned int' but the argument has type 'long'}}
+ // expected-warning@-8 {{'O' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'o'?}}
+ // expected-warning@-8 {{'O' conversion specifier is not supported by ISO C}} expected-note@-8 {{did you mean to use 'o'?}} expected-warning@-8 {{format specifies type 'unsigned int' but the argument has type 'long'}}
+#else
+ // expected-warning@-15 {{invalid conversion specifier 'D'}}
+ // expected-warning@-15 {{invalid conversion specifier 'D'}}
+ // expected-warning@-15 {{invalid conversion specifier 'U'}}
+ // expected-warning@-15 {{invalid conversion specifier 'U'}}
+ // expected-warning@-15 {{invalid conversion specifier 'O'}}
+ // expected-warning@-15 {{invalid conversion specifier 'O'}}
+#endif
+}
+
+#ifdef ALLOWED
+void testPrintf(short x, long y) {
+ printf("%hD", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ printf("%lD", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ printf("%hU", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'u'?}}
+ printf("%lU", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'u'?}}
+ printf("%hO", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'o'?}}
+ printf("%lO", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'o'?}}
+
+ printf("%+'0.5lD", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ printf("% '0.5lD", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ printf("%#0.5lO", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'o'?}}
+ printf("%'0.5lU", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'u'?}}
+}
+
+void testScanf(short *x, long *y) {
+ scanf("%hD", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ scanf("%lD", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'd'?}}
+ scanf("%hU", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'u'?}}
+ scanf("%lU", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'u'?}}
+ scanf("%hO", x); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'o'?}}
+ scanf("%lO", y); // expected-warning{{conversion specifier is not supported by ISO C}} expected-note {{did you mean to use 'o'?}}
+}
+#endif
diff --git a/test/Sema/format-strings-gnu.c b/test/Sema/format-strings-gnu.c
new file mode 100644
index 000000000000..f4910856b00f
--- /dev/null
+++ b/test/Sema/format-strings-gnu.c
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple thumbv6-apple-ios4.0 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-mingw32 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-pc-win32 %s
+
+// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu -DALLOWED %s
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-unknown-freebsd -DALLOWED %s
+
+int printf(const char *restrict, ...);
+int scanf(const char * restrict, ...) ;
+
+void test() {
+ long notLongEnough = 1;
+ long long quiteLong = 2;
+
+ printf("%Ld", notLongEnough); // expected-warning {{format specifies type 'long long' but the argument has type 'long'}}
+ printf("%Ld", quiteLong);
+
+#ifndef ALLOWED
+ // expected-warning@-4 {{length modifier 'L' results in undefined behavior or no effect with 'd' conversion specifier}}
+ // expected-note@-5 {{did you mean to use 'll'?}}
+
+ // expected-warning@-6 {{length modifier 'L' results in undefined behavior or no effect with 'd' conversion specifier}}
+ // expected-note@-7 {{did you mean to use 'll'?}}
+#endif
+}
+
+void testAlwaysInvalid() {
+ // We should not suggest 'll' here!
+ printf("%Lc", 'a'); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 'c' conversion specifier}}
+ printf("%Ls", "a"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
+}
+
+#ifdef ALLOWED
+// PR 9466: clang: doesn't know about %Lu, %Ld, and %Lx
+void printf_longlong(long long x, unsigned long long y) {
+ printf("%Ld", y); // no-warning
+ printf("%Lu", y); // no-warning
+ printf("%Lx", y); // no-warning
+ printf("%Ld", x); // no-warning
+ printf("%Lu", x); // no-warning
+ printf("%Lx", x); // no-warning
+ printf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
+}
+
+void scanf_longlong(long long *x, unsigned long long *y) {
+ scanf("%Ld", y); // no-warning
+ scanf("%Lu", y); // no-warning
+ scanf("%Lx", y); // no-warning
+ scanf("%Ld", x); // no-warning
+ scanf("%Lu", x); // no-warning
+ scanf("%Lx", x); // no-warning
+ scanf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
+}
+#endif
diff --git a/test/Sema/format-strings-non-iso.c b/test/Sema/format-strings-non-iso.c
index ed8095f10a4f..ee4594696138 100644
--- a/test/Sema/format-strings-non-iso.c
+++ b/test/Sema/format-strings-non-iso.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -pedantic %s
+// RUN: %clang_cc1 -triple i686-linux-gnu -fsyntax-only -verify -std=c99 -pedantic %s
int printf(const char *restrict, ...);
int scanf(const char * restrict, ...);
@@ -7,8 +7,8 @@ void f(void) {
char *cp;
// The 'q' length modifier.
- printf("%qd", (long long)42); // expected-warning{{'q' length modifier is not supported by ISO C}}
- scanf("%qd", (long long *)0); // expected-warning{{'q' length modifier is not supported by ISO C}}
+ printf("%qd", (long long)42); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
+ scanf("%qd", (long long *)0); // expected-warning{{'q' length modifier is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
// The 'm' length modifier.
scanf("%ms", &cp); // expected-warning{{'m' length modifier is not supported by ISO C}}
@@ -18,11 +18,11 @@ void f(void) {
printf("%C", L'x'); // expected-warning{{'C' conversion specifier is not supported by ISO C}}
// Combining 'L' with an integer conversion specifier.
- printf("%Li", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'i' is not supported by ISO C}}
- printf("%Lo", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'o' is not supported by ISO C}}
- printf("%Lu", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'u' is not supported by ISO C}}
- printf("%Lx", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'x' is not supported by ISO C}}
- printf("%LX", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'X' is not supported by ISO C}}
+ printf("%Li", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'i' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
+ printf("%Lo", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'o' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
+ printf("%Lu", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'u' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
+ printf("%Lx", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'x' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
+ printf("%LX", (long long)42); // expected-warning{{using length modifier 'L' with conversion specifier 'X' is not supported by ISO C}} expected-note{{did you mean to use 'll'?}}
// Positional arguments.
printf("%1$d", 42); // expected-warning{{positional arguments are not supported by ISO C}}
diff --git a/test/Sema/format-strings-scanf.c b/test/Sema/format-strings-scanf.c
index 235ac11faa1c..d66bed5ffbd6 100644
--- a/test/Sema/format-strings-scanf.c
+++ b/test/Sema/format-strings-scanf.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -triple i386-apple-darwin9 -Wformat-nonliteral %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s
// Test that -Wformat=0 works:
// RUN: %clang_cc1 -fsyntax-only -Werror -Wformat=0 %s
@@ -107,22 +107,12 @@ void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
// Test argument type check for the 'm' length modifier.
scanf("%ms", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
- scanf("%mS", fp); // expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
+ scanf("%mS", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
scanf("%mc", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
- scanf("%mC", fp); // expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
+ scanf("%mC", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
}
-void test_longlong(long long *x, unsigned long long *y) {
- scanf("%Ld", y); // no-warning
- scanf("%Lu", y); // no-warning
- scanf("%Lx", y); // no-warning
- scanf("%Ld", x); // no-warning
- scanf("%Lu", x); // no-warning
- scanf("%Lx", x); // no-warning
- scanf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
-}
-
void test_quad(int *x, long long *llx) {
scanf("%qd", x); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
scanf("%qd", llx); // no-warning
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 86b9296108c6..8fb1218b99ac 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -117,6 +117,7 @@ void check_writeback_specifier()
printf("%qn", (int*)0); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}}
printf("%Ln", 0); // expected-warning{{length modifier 'L' results in undefined behavior or no effect with 'n' conversion specifier}}
+ // expected-note@-1{{did you mean to use 'll'?}}
}
void check_invalid_specifier(FILE* fp, char *buf)
@@ -531,17 +532,6 @@ void pr9751() {
0.0); // expected-warning{{format specifies}}
}
-// PR 9466: clang: doesn't know about %Lu, %Ld, and %Lx
-void printf_longlong(long long x, unsigned long long y) {
- printf("%Ld", y); // no-warning
- printf("%Lu", y); // no-warning
- printf("%Lx", y); // no-warning
- printf("%Ld", x); // no-warning
- printf("%Lu", x); // no-warning
- printf("%Lx", x); // no-warning
- printf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}}
-}
-
void __attribute__((format(strfmon,1,2))) monformat(const char *fmt, ...);
void __attribute__((format(strftime,1,0))) dateformat(const char *fmt);
diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 7076bdf3bd1f..ff8e003cd722 100644
--- a/test/Sema/function-redecl.c
+++ b/test/Sema/function-redecl.c
@@ -129,3 +129,7 @@ void test_x() {
enum e0 {one};
void f3();
void f3(enum e0 x) {}
+
+enum incomplete_enum;
+void f4(); // expected-note {{previous declaration is here}}
+void f4(enum incomplete_enum); // expected-error {{conflicting types for 'f4'}}
diff --git a/test/Sema/heinous-extensions-on.c b/test/Sema/heinous-extensions-on.c
index 176f4727ef2b..5b00407b1736 100644
--- a/test/Sema/heinous-extensions-on.c
+++ b/test/Sema/heinous-extensions-on.c
@@ -3,7 +3,7 @@
void foo() {
int a;
// PR3788
- asm("nop" : : "m"((int)(a))); // expected-warning {{cast in a inline asm context requiring an l-value}}
+ asm("nop" : : "m"((int)(a))); // expected-warning {{cast in an inline asm context requiring an l-value}}
// PR3794
- asm("nop" : "=r"((unsigned)a)); // expected-warning {{cast in a inline asm context requiring an l-value}}
+ asm("nop" : "=r"((unsigned)a)); // expected-warning {{cast in an inline asm context requiring an l-value}}
}
diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c
index ee61ac34a81a..e7b42c4e9a14 100644
--- a/test/Sema/i-c-e.c
+++ b/test/Sema/i-c-e.c
@@ -1,4 +1,4 @@
-// RUN: %clang %s -ffreestanding -fsyntax-only -Xclang -verify -pedantic -fpascal-strings -std=c99
+// RUN: %clang %s -ffreestanding -Wno-int-to-pointer-cast -fsyntax-only -Xclang -verify -pedantic -fpascal-strings -std=c99
#include <stdint.h>
#include <limits.h>
diff --git a/test/Sema/implicit-builtin-freestanding.c b/test/Sema/implicit-builtin-freestanding.c
index 505e5221eff8..385cf1f751ca 100644
--- a/test/Sema/implicit-builtin-freestanding.c
+++ b/test/Sema/implicit-builtin-freestanding.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
+// expected-no-diagnostics
int malloc(int a) { return a; }
diff --git a/test/Sema/init-struct-qualified.c b/test/Sema/init-struct-qualified.c
index 49ec7cc5e060..9d18e224f8eb 100644
--- a/test/Sema/init-struct-qualified.c
+++ b/test/Sema/init-struct-qualified.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify < %s
+// expected-no-diagnostics
typedef float CGFloat;
typedef struct _NSPoint { CGFloat x; CGFloat y; } NSPoint;
typedef struct _NSSize { CGFloat width; CGFloat height; } NSSize;
diff --git a/test/Sema/init-vector.c b/test/Sema/init-vector.c
index f0cf32bd3f9c..a95e789e3a1b 100644
--- a/test/Sema/init-vector.c
+++ b/test/Sema/init-vector.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef float __attribute__((vector_size (16))) v4f_t;
diff --git a/test/Sema/int-arith-convert.c b/test/Sema/int-arith-convert.c
index c56ab3b76302..0f425bd0e45b 100644
--- a/test/Sema/int-arith-convert.c
+++ b/test/Sema/int-arith-convert.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple=i686-linux-gnu -fsyntax-only -verify %s
+// expected-no-diagnostics
// Check types are the same through redeclaration
unsigned long x;
diff --git a/test/Sema/invalid-decl.c b/test/Sema/invalid-decl.c
index 2699b254926a..b2c2aaf1a0f0 100644
--- a/test/Sema/invalid-decl.c
+++ b/test/Sema/invalid-decl.c
@@ -29,3 +29,12 @@ typedef struct {
void f(StructType *buf) {
buf->fun = 0;
}
+
+// rdar://11743706
+static void bar(hid_t, char); // expected-error {{expected identifier}}
+
+static void bar(hid_t p, char); // expected-error {{unknown type name 'hid_t'}}
+
+void foo() {
+ (void)bar;
+}
diff --git a/test/Sema/knr-variadic-def.c b/test/Sema/knr-variadic-def.c
index 6d5d63208bf0..934f32fd26b1 100644
--- a/test/Sema/knr-variadic-def.c
+++ b/test/Sema/knr-variadic-def.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// expected-no-diagnostics
// PR4287
#include <stdarg.h>
diff --git a/test/Sema/many-logical-ops.c b/test/Sema/many-logical-ops.c
index 09a76841032f..ec3bbda4dd4c 100644
--- a/test/Sema/many-logical-ops.c
+++ b/test/Sema/many-logical-ops.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wconstant-conversion -verify %s
+// expected-no-diagnostics
// rdar://10913206&10941790
// Check that we don't get stack overflow trying to evaluate a huge number of
diff --git a/test/Sema/member-reference.c b/test/Sema/member-reference.c
index 7bda14303a2d..edbbea59ac87 100644
--- a/test/Sema/member-reference.c
+++ b/test/Sema/member-reference.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
+// expected-no-diagnostics
struct simple { int i; };
diff --git a/test/Sema/mms-bitfields.c b/test/Sema/mms-bitfields.c
new file mode 100644
index 000000000000..d238a7a10d0d
--- /dev/null
+++ b/test/Sema/mms-bitfields.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -mms-bitfields -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
+// expected-no-diagnostics
+
+// The -mms-bitfields commandline parameter should behave the same
+// as the ms_struct attribute.
+struct
+{
+ int a : 1;
+ short b : 1;
+} t;
+
+// MS pads out bitfields between different types.
+static int arr[(sizeof(t) == 8) ? 1 : -1];
diff --git a/test/Sema/ms-inline-asm.c b/test/Sema/ms-inline-asm.c
new file mode 100644
index 000000000000..f6a0fdcb42eb
--- /dev/null
+++ b/test/Sema/ms-inline-asm.c
@@ -0,0 +1,35 @@
+// REQUIRES: x86-64-registered-target
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -fms-extensions -fenable-experimental-ms-inline-asm -Wno-microsoft -verify -fsyntax-only
+
+void t1(void) {
+ __asm __asm // expected-error {{__asm used with no assembly instructions}}
+}
+
+void f() {
+ int foo;
+ __asm {
+ mov eax, eax
+ .unknowndirective // expected-error {{unknown directive}}
+ }
+ f();
+ __asm {
+ mov eax, 1+=2 // expected-error 2 {{unknown token in expression}}
+ }
+ f();
+ __asm {
+ mov eax, 1+++ // expected-error 2 {{unknown token in expression}}
+ }
+ f();
+ __asm {
+ mov eax, TYPE cat // expected-error {{Unable to lookup TYPE of expr!}}
+ }
+ f();
+ __asm {
+ mov eax, SIZE foo // expected-error {{Unsupported directive!}}
+ }
+ f();
+ __asm {
+ mov eax, LENGTH foo // expected-error {{Unsupported directive!}}
+ }
+
+}
diff --git a/test/Sema/ms_wide_predefined_expr.cpp b/test/Sema/ms_wide_predefined_expr.cpp
index 8e816e00b37a..d56d1576cd0c 100644
--- a/test/Sema/ms_wide_predefined_expr.cpp
+++ b/test/Sema/ms_wide_predefined_expr.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
+// expected-no-diagnostics
// Wide character predefined identifiers
#define _STR2WSTR(str) L##str
diff --git a/test/Sema/no-format-y2k-turnsoff-format.c b/test/Sema/no-format-y2k-turnsoff-format.c
index b206ecdfc155..a26a0ce95709 100644
--- a/test/Sema/no-format-y2k-turnsoff-format.c
+++ b/test/Sema/no-format-y2k-turnsoff-format.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -Wformat -Wno-format-y2k
+// RUN: %clang_cc1 -verify -fsyntax-only -Wformat -Wno-format-y2k %s
// rdar://9504680
void foo(const char *, ...) __attribute__((__format__ (__printf__, 1, 2)));
diff --git a/test/Sema/outof-range-constant-compare.c b/test/Sema/outof-range-constant-compare.c
new file mode 100644
index 000000000000..4b1637c46c5e
--- /dev/null
+++ b/test/Sema/outof-range-constant-compare.c
@@ -0,0 +1,149 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -Wtautological-constant-out-of-range-compare -verify %s
+// rdar://12202422
+
+int value(void);
+
+int main()
+{
+ int a = value();
+ if (a == 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a != 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (a < 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (a <= 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (a > 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a >= 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+
+ if (0x1234567812345678L == a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (0x1234567812345678L != a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (0x1234567812345678L < a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (0x1234567812345678L <= a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (0x1234567812345678L > a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (0x1234567812345678L >= a) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (a == 0x1234567812345678LL) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a == -0x1234567812345678L) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a < -0x1234567812345678L) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a > -0x1234567812345678L) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+ if (a <= -0x1234567812345678L) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
+ return 0;
+ if (a >= -0x1234567812345678L) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
+ return 0;
+
+
+ if (a == 0x12345678L) // no warning
+ return 1;
+
+ short s = value();
+ if (s == 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+ if (s != 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ if (s < 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ if (s <= 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ if (s > 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+ if (s >= 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+
+ if (0x1234567812345678L == s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+ if (0x1234567812345678L != s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ if (0x1234567812345678L < s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+ if (0x1234567812345678L <= s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
+ return 0;
+ if (0x1234567812345678L > s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ if (0x1234567812345678L >= s) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
+ return 0;
+ long l = value();
+ if (l == 0x1234567812345678L)
+ return 0;
+ if (l != 0x1234567812345678L)
+ return 0;
+ if (l < 0x1234567812345678L)
+ return 0;
+ if (l <= 0x1234567812345678L)
+ return 0;
+ if (l > 0x1234567812345678L)
+ return 0;
+ if (l >= 0x1234567812345678L)
+ return 0;
+
+ if (0x1234567812345678L == l)
+ return 0;
+ if (0x1234567812345678L != l)
+ return 0;
+ if (0x1234567812345678L < l)
+ return 0;
+ if (0x1234567812345678L <= l)
+ return 0;
+ if (0x1234567812345678L > l)
+ return 0;
+ if (0x1234567812345678L >= l)
+ return 0;
+
+ unsigned un = 0;
+ if (un == 0x0000000000000000L)
+ return 0;
+ if (un != 0x0000000000000000L)
+ return 0;
+ if (un < 0x0000000000000000L)
+ return 0;
+ if (un <= 0x0000000000000000L)
+ return 0;
+ if (un > 0x0000000000000000L)
+ return 0;
+ if (un >= 0x0000000000000000L)
+ return 0;
+
+ if (0x0000000000000000L == un)
+ return 0;
+ if (0x0000000000000000L != un)
+ return 0;
+ if (0x0000000000000000L < un)
+ return 0;
+ if (0x0000000000000000L <= un)
+ return 0;
+ if (0x0000000000000000L > un)
+ return 0;
+ if (0x0000000000000000L >= un)
+ return 0;
+ float fl = 0;
+ if (fl == 0x0000000000000000L) // no warning
+ return 0;
+
+ float dl = 0;
+ if (dl == 0x0000000000000000L) // no warning
+ return 0;
+
+ enum E {
+ yes,
+ no,
+ maybe
+ };
+ enum E e;
+
+ if (e == 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'enum E' is always false}}
+ return 0;
+
+ return 1;
+}
diff --git a/test/Sema/overloaded-func-transparent-union.c b/test/Sema/overloaded-func-transparent-union.c
index fa0314e946f2..acdc5898b026 100644
--- a/test/Sema/overloaded-func-transparent-union.c
+++ b/test/Sema/overloaded-func-transparent-union.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar:// 9129552
// PR9406
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index 9751336018b7..c3b3aa77c5e6 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -13,13 +13,13 @@ void if_assign(void) {
void bitwise_rel(unsigned i) {
(void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} \
// expected-note{{place parentheses around the & expression to evaluate it first}} \
- // expected-note{{place parentheses around the == expression to silence this warning}}
+ // expected-note{{place parentheses around the '==' expression to silence this warning}}
(void)(0 == i & 0x2); // expected-warning {{& has lower precedence than ==}} \
// expected-note{{place parentheses around the & expression to evaluate it first}} \
- // expected-note{{place parentheses around the == expression to silence this warning}}
+ // expected-note{{place parentheses around the '==' expression to silence this warning}}
(void)(i & 0xff < 30); // expected-warning {{& has lower precedence than <}} \
// expected-note{{place parentheses around the & expression to evaluate it first}} \
- // expected-note{{place parentheses around the < expression to silence this warning}}
+ // expected-note{{place parentheses around the '<' expression to silence this warning}}
(void)((i & 0x2) == 0);
(void)(i & (0x2 == 0));
// Eager logical op
diff --git a/test/Sema/parentheses.cpp b/test/Sema/parentheses.cpp
index 767416677e00..8f5f24652dd7 100644
--- a/test/Sema/parentheses.cpp
+++ b/test/Sema/parentheses.cpp
@@ -22,6 +22,8 @@ public:
operator int();
Stream &operator<<(int);
Stream &operator<<(const char*);
+ Stream &operator>>(int);
+ Stream &operator>>(const char*);
};
void f(Stream& s, bool b) {
@@ -45,3 +47,13 @@ void test(S *s, bool (S::*m_ptr)()) {
// Don't crash on unusual member call expressions.
(void)((s->*m_ptr)() ? "foo" : "bar");
}
+
+void test(int a, int b, int c) {
+ (void)(a >> b + c); // expected-warning {{operator '>>' has lower precedence than '+'; '+' will be evaluated first}} \
+ expected-note {{place parentheses around the '+' expression to silence this warning}}
+ (void)(a - b << c); // expected-warning {{operator '<<' has lower precedence than '-'; '-' will be evaluated first}} \
+ expected-note {{place parentheses around the '-' expression to silence this warning}}
+ Stream() << b + c;
+ Stream() >> b + c; // expected-warning {{operator '>>' has lower precedence than '+'; '+' will be evaluated first}} \
+ expected-note {{place parentheses around the '+' expression to silence this warning}}
+}
diff --git a/test/Sema/pragma-align-mac68k.c b/test/Sema/pragma-align-mac68k.c
index fb8da515bbc7..fd93fcbd5ca4 100644
--- a/test/Sema/pragma-align-mac68k.c
+++ b/test/Sema/pragma-align-mac68k.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
#include <stddef.h>
@@ -96,3 +97,15 @@ extern int a11_0[offsetof(struct s11, f0) == 0 ? 1 : -1];
extern int a11_1[offsetof(struct s11, f1) == 2 ? 1 : -1];
extern int a11_2[sizeof(struct s11) == 10 ? 1 : -1];
extern int a11_3[__alignof(struct s11) == 2 ? 1 : -1];
+
+#pragma options align=reset
+
+void f12(void) {
+ #pragma options align=mac68k
+ struct s12 {
+ char f0;
+ int f1;
+ };
+ #pragma options align=reset
+ extern int a12[sizeof(struct s12) == 6 ? 1 : -1];
+}
diff --git a/test/Sema/pragma-align-packed.c b/test/Sema/pragma-align-packed.c
index 74fbd13d162b..b8daf40b2c82 100644
--- a/test/Sema/pragma-align-packed.c
+++ b/test/Sema/pragma-align-packed.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
#pragma pack(push, 1)
struct s0 {
diff --git a/test/Sema/pragma-ms_struct.c b/test/Sema/pragma-ms_struct.c
index d76ee8bab3eb..6533320e518d 100644
--- a/test/Sema/pragma-ms_struct.c
+++ b/test/Sema/pragma-ms_struct.c
@@ -31,6 +31,12 @@ struct S {
unsigned long bf_2 : 12;
} __attribute__((ms_struct)) t2;
+enum
+{
+ A = 0,
+ B,
+ C
+} __attribute__((ms_struct)) e1; // expected-warning {{'ms_struct' attribute ignored}}
// rdar://10513599
#pragma ms_struct on
diff --git a/test/Sema/pragma-pack-2.c b/test/Sema/pragma-pack-2.c
index 4a4c202c71ad..3696a22d5aa5 100644
--- a/test/Sema/pragma-pack-2.c
+++ b/test/Sema/pragma-pack-2.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// expected-no-diagnostics
#include <stddef.h>
diff --git a/test/Sema/pragma-pack-3.c b/test/Sema/pragma-pack-3.c
index d97359e45b71..e7a6cee55057 100644
--- a/test/Sema/pragma-pack-3.c
+++ b/test/Sema/pragma-pack-3.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// expected-no-diagnostics
// Stack: [], Alignment: 8
diff --git a/test/Sema/pragma-pack-4.c b/test/Sema/pragma-pack-4.c
index b06fc0eaf15f..6a09e14d88cf 100644
--- a/test/Sema/pragma-pack-4.c
+++ b/test/Sema/pragma-pack-4.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify
+// expected-no-diagnostics
// rdar://problem/7095436
#pragma pack(4)
diff --git a/test/Sema/pragma-pack-5.c b/test/Sema/pragma-pack-5.c
index 95bbe1fe7e94..24bd4cd7d922 100644
--- a/test/Sema/pragma-pack-5.c
+++ b/test/Sema/pragma-pack-5.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -verify -ffreestanding
+// expected-no-diagnostics
// <rdar://problem/10494810> and PR9560
// Check #pragma pack handling with bitfields.
diff --git a/test/Sema/pragma-pack-6.c b/test/Sema/pragma-pack-6.c
index 40659c23bda8..c87c99d5dab9 100644
--- a/test/Sema/pragma-pack-6.c
+++ b/test/Sema/pragma-pack-6.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple i686-apple-darwin9 %s -fsyntax-only -verify
+// expected-no-diagnostics
// Pragma pack handling with tag declarations
diff --git a/test/Sema/pragma-pack-and-options-align.c b/test/Sema/pragma-pack-and-options-align.c
index ebf1adee02f3..5bc7c83594cd 100644
--- a/test/Sema/pragma-pack-and-options-align.c
+++ b/test/Sema/pragma-pack-and-options-align.c
@@ -38,5 +38,16 @@ struct s3 {
};
extern int a[sizeof(struct s3) == 8 ? 1 : -1];
+#pragma pack(push,2)
+#pragma options align=power
+struct s4 {
+ char c;
+ int x;
+};
+#pragma pack(pop)
+#pragma options align=reset
+extern int a[sizeof(struct s4) == 8 ? 1 : -1];
+
/* expected-warning {{#pragma options align=reset failed: stack empty}} */ #pragma options align=reset
/* expected-warning {{#pragma pack(pop, ...) failed: stack empty}} */ #pragma pack(pop)
+
diff --git a/test/Sema/private-extern.c b/test/Sema/private-extern.c
index 25591dc5b1f2..e480f3f22481 100644
--- a/test/Sema/private-extern.c
+++ b/test/Sema/private-extern.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
static int g0; // expected-note{{previous definition}}
int g0; // expected-error{{non-static declaration of 'g0' follows static declaration}}
diff --git a/test/Sema/return-silent.c b/test/Sema/return-silent.c
index eb9641b7f3be..83c3a0a17905 100644
--- a/test/Sema/return-silent.c
+++ b/test/Sema/return-silent.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -Wno-return-type -fsyntax-only -verify
+// expected-no-diagnostics
int t14() {
return;
diff --git a/test/Sema/short-enums.c b/test/Sema/short-enums.c
index 6605c4e8fc07..9bf0064646a7 100644
--- a/test/Sema/short-enums.c
+++ b/test/Sema/short-enums.c
@@ -1,5 +1,6 @@
// RUN: not %clang_cc1 -fsyntax-only %s -verify
// RUN: %clang_cc1 -fshort-enums -fsyntax-only %s -verify
+// expected-no-diagnostics
enum x { A };
int t0[sizeof(enum x) == 1 ? 1 : -1];
diff --git a/test/Sema/stdcall-fastcall-x64.c b/test/Sema/stdcall-fastcall-x64.c
new file mode 100644
index 000000000000..d2a475eda1b8
--- /dev/null
+++ b/test/Sema/stdcall-fastcall-x64.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s
+
+// CC qualifier can be applied only to functions
+int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies to function types; type here is 'int'}}
+int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies to function types; type here is 'int'}}
+
+// Different CC qualifiers are not compatible
+void __attribute__((stdcall, fastcall)) foo3(void); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
+void __attribute__((stdcall)) foo4(); // expected-warning{{calling convention 'stdcall' ignored for this target}}
+void __attribute__((fastcall)) foo4(void); // expected-warning {{calling convention 'fastcall' ignored for this target}}
+
+// rdar://8876096
+void rdar8876096foo1(int i, int j) __attribute__((fastcall, cdecl)); // expected-warning{{calling convention 'fastcall' ignored for this target}}
+void rdar8876096foo2(int i, int j) __attribute__((fastcall, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
+void rdar8876096foo3(int i, int j) __attribute__((fastcall, regparm(2))); // expected-warning {{calling convention 'fastcall' ignored for this target}}
+void rdar8876096foo4(int i, int j) __attribute__((stdcall, cdecl)); // expected-warning{{calling convention 'stdcall' ignored for this target}}
+void rdar8876096foo5(int i, int j) __attribute__((stdcall, fastcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}
+void rdar8876096foo6(int i, int j) __attribute__((cdecl, fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}
+void rdar8876096foo7(int i, int j) __attribute__((cdecl, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}}
+void rdar8876096foo8(int i, int j) __attribute__((regparm(2), fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}
diff --git a/test/Sema/stdcall-fastcall.c b/test/Sema/stdcall-fastcall.c
index eeacf94eb482..dea1fc5e7af7 100644
--- a/test/Sema/stdcall-fastcall.c
+++ b/test/Sema/stdcall-fastcall.c
@@ -1,4 +1,3 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s
// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin10 %s
// CC qualifier can be applied only to functions
diff --git a/test/Sema/struct-cast.c b/test/Sema/struct-cast.c
index 30ef89242afc..8aa7ca90dd13 100644
--- a/test/Sema/struct-cast.c
+++ b/test/Sema/struct-cast.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only %s -verify
+// expected-no-diagnostics
struct S {
int one;
diff --git a/test/Sema/struct-packed-align.c b/test/Sema/struct-packed-align.c
index 6ca6a6096c4e..166d5eb1ff8d 100644
--- a/test/Sema/struct-packed-align.c
+++ b/test/Sema/struct-packed-align.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// Packed structs.
struct s {
diff --git a/test/Sema/surpress-deprecated.c b/test/Sema/surpress-deprecated.c
index dd673b9646ea..db9ab3f4eeb6 100644
--- a/test/Sema/surpress-deprecated.c
+++ b/test/Sema/surpress-deprecated.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
+// expected-no-diagnostics
extern void OldFunction() __attribute__((deprecated));
int main (int argc, const char * argv[]) {
diff --git a/test/Sema/template-specialization.cpp b/test/Sema/template-specialization.cpp
new file mode 100644
index 000000000000..ae7bc332fcce
--- /dev/null
+++ b/test/Sema/template-specialization.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// Verify the absence of assertion failures when solving calls to unresolved
+// template member functions.
+
+struct A {
+ template <typename T>
+ static void bar(int) { } // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
+};
+
+struct B {
+ template <int i>
+ static void foo() {
+ int array[i];
+ A::template bar(array[0]); // expected-error {{no matching function for call to 'bar'}}
+ }
+};
+
+int main() {
+ B::foo<4>(); // expected-note {{in instantiation of function template specialization 'B::foo<4>'}}
+ return 0;
+}
diff --git a/test/Sema/tentative-decls.c b/test/Sema/tentative-decls.c
index e14540ba8417..bf2b1e4ee6a5 100644
--- a/test/Sema/tentative-decls.c
+++ b/test/Sema/tentative-decls.c
@@ -33,7 +33,8 @@ static int i3 = 5;
extern int i3;
// rdar://7703982
-__private_extern__ int pExtern; // expected-warning {{Use of __private_extern__ on tentative definition has unexpected behaviour}}
+__private_extern__ int pExtern; // expected-warning {{use of __private_extern__ on a declaration may not produce external symbol private to the linkage unit and is deprecated}} \
+// expected-note {{use __attribute__((visibility("hidden"))) attribute instead}}
int pExtern = 0;
int i4;
diff --git a/test/Sema/thread-specifier.c b/test/Sema/thread-specifier.c
index 0d439b1669c1..8c40fcd0a645 100644
--- a/test/Sema/thread-specifier.c
+++ b/test/Sema/thread-specifier.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s
__thread int t1;
__thread extern int t2; // expected-warning {{'__thread' before 'extern'}}
@@ -21,3 +21,10 @@ __thread int t15; // expected-note {{previous definition is here}}
int t15; // expected-error {{non-thread-local declaration of 't15' follows thread-local declaration}}
int t16; // expected-note {{previous definition is here}}
__thread int t16; // expected-error {{thread-local declaration of 't16' follows non-thread-local declaration}}
+
+// PR13720
+__thread int thread_int;
+int *thread_int_ptr = &thread_int; // expected-error{{initializer element is not a compile-time constant}}
+void g() {
+ int *p = &thread_int; // This is perfectly fine, though.
+}
diff --git a/test/Sema/tls.c b/test/Sema/tls.c
index 3b2a441bfea8..4e5cfef0a3f3 100644
--- a/test/Sema/tls.c
+++ b/test/Sema/tls.c
@@ -17,4 +17,7 @@
// RUN: not %clang_cc1 -triple x86_64-pc-openbsd -fsyntax-only %s
// RUN: not %clang_cc1 -triple i386-pc-openbsd -fsyntax-only %s
+// Haiku does not suppport TLS.
+// RUN: not %clang_cc1 -triple i586-pc-haiku -fsyntax-only %s
+
__thread int x;
diff --git a/test/Sema/transparent-union-pointer.c b/test/Sema/transparent-union-pointer.c
index 31c93914b819..bf1fb17ac6f8 100644
--- a/test/Sema/transparent-union-pointer.c
+++ b/test/Sema/transparent-union-pointer.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
typedef union {
union wait *__uptr;
diff --git a/test/Sema/typedef-prototype.c b/test/Sema/typedef-prototype.c
index 8372154ce0ef..98b1ab809997 100644
--- a/test/Sema/typedef-prototype.c
+++ b/test/Sema/typedef-prototype.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef int unary_int_func(int arg);
unary_int_func add_one;
diff --git a/test/Sema/types.c b/test/Sema/types.c
index 3bec83e528b2..6ae1a92e0543 100644
--- a/test/Sema/types.c
+++ b/test/Sema/types.c
@@ -43,7 +43,7 @@ int i[(short)1];
enum e { e_1 };
extern int j[sizeof(enum e)]; // expected-note {{previous definition}}
-int j[42]; // expected-error {{redefinition of 'j' with a different type}}
+int j[42]; // expected-error {{redefinition of 'j' with a different type: 'int [42]' vs 'int [4]'}}
// rdar://6880104
_Decimal32 x; // expected-error {{GNU decimal type extension not supported}}
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index 634ae0dc4284..9e3dd9d2875b 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -508,3 +508,26 @@ int self_init_in_cond(int *p) {
int n = ((p && (0 || 1)) && (n = *p)) ? n : -1; // ok
return n;
}
+
+void test_analyzer_noreturn_aux() __attribute__((analyzer_noreturn));
+
+void test_analyzer_noreturn(int y) {
+ int x; // expected-note {{initialize the variable 'x' to silence this warning}}
+ if (y) {
+ test_analyzer_noreturn_aux();
+ ++x; // no-warning
+ }
+ else {
+ ++x; // expected-warning {{variable 'x' is uninitialized when used here}}
+ }
+}
+void test_analyzer_noreturn_2(int y) {
+ int x;
+ if (y) {
+ test_analyzer_noreturn_aux();
+ }
+ else {
+ x = 1;
+ }
+ ++x; // no-warning
+}
diff --git a/test/Sema/unnamed-bitfield-init.c b/test/Sema/unnamed-bitfield-init.c
index f3cc49c34bf2..6fa18014179e 100644
--- a/test/Sema/unnamed-bitfield-init.c
+++ b/test/Sema/unnamed-bitfield-init.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
typedef struct {
int a; int : 24; char b;
} S;
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 056d09a8713b..aa81febdbbde 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -122,3 +122,14 @@ void f(int i, ...) {
// PR8371
int fn5() __attribute__ ((__const));
+
+// OpenSSL has some macros like this; we shouldn't warn on the cast.
+#define M1(a, b) (long)foo((a), (b))
+// But, we should still warn on other subexpressions of casts in macros.
+#define M2 (long)0;
+void t11(int i, int j) {
+ M1(i, j); // no warning
+ M2; // expected-warning {{expression result unused}}
+}
+#undef M1
+#undef M2
diff --git a/test/Sema/va_arg_x86_64.c b/test/Sema/va_arg_x86_64.c
index 9f514c1f59e4..2659a1b6d4cd 100644
--- a/test/Sema/va_arg_x86_64.c
+++ b/test/Sema/va_arg_x86_64.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple=x86_64-unknown-freebsd7.0 %s
+// expected-no-diagnostics
// PR2631
char* foo(char *fmt, __builtin_va_list ap)
diff --git a/test/Sema/variadic-block.c b/test/Sema/variadic-block.c
index ba4bb71c9750..4f23cb8e0814 100644
--- a/test/Sema/variadic-block.c
+++ b/test/Sema/variadic-block.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only -fblocks
+// expected-no-diagnostics
#include <stdarg.h>
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index f1cf0134dc13..7fa6e86aa10e 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -10,22 +10,22 @@ void f()
t2 v2;
t3 v3;
- v2 = (t2)v1; // -expected-error {{invalid conversion between vector type \
+ v2 = (t2)v1; // expected-error {{invalid conversion between vector type \
't2' and 't1' of different size}}
- v1 = (t1)v2; // -expected-error {{invalid conversion between vector type \
+ v1 = (t1)v2; // expected-error {{invalid conversion between vector type \
't1' and 't2' of different size}}
v3 = (t3)v2;
- v1 = (t1)(char *)10; // -expected-error {{invalid conversion between vector \
+ v1 = (t1)(char *)10; // expected-error {{invalid conversion between vector \
type 't1' and scalar type 'char *'}}
v1 = (t1)(long long)10;
- v1 = (t1)(short)10; // -expected-error {{invalid conversion between vector \
+ v1 = (t1)(short)10; // expected-error {{invalid conversion between vector \
type 't1' and integer type 'short' of different size}}
long long r1 = (long long)v1;
- short r2 = (short)v1; // -expected-error {{invalid conversion between vector \
+ short r2 = (short)v1; // expected-error {{invalid conversion between vector \
type 't1' and integer type 'short' of different size}}
- char *r3 = (char *)v1; // -expected-error {{invalid conversion between vector\
+ char *r3 = (char *)v1; // expected-error {{invalid conversion between vector\
type 't1' and scalar type 'char *'}}
}
diff --git a/test/Sema/vfprintf-valid-redecl.c b/test/Sema/vfprintf-valid-redecl.c
index 14fbbc47ddbc..5c5ce8d12b00 100644
--- a/test/Sema/vfprintf-valid-redecl.c
+++ b/test/Sema/vfprintf-valid-redecl.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify
+// expected-no-diagnostics
// PR4290
// The following declaration is compatible with vfprintf, so we shouldn't
diff --git a/test/Sema/warn-bad-function-cast.c b/test/Sema/warn-bad-function-cast.c
new file mode 100644
index 000000000000..41a3f7824e91
--- /dev/null
+++ b/test/Sema/warn-bad-function-cast.c
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wbad-function-cast -triple x86_64-unknown-unknown -verify
+// rdar://9103192
+
+void vf(void);
+int if1(void);
+char if2(void);
+long if3(void);
+float rf1(void);
+double rf2(void);
+_Complex double cf(void);
+enum e { E1 } ef(void);
+_Bool bf(void);
+char *pf1(void);
+int *pf2(void);
+
+void
+foo(void)
+{
+ /* Casts to void types are always OK. */
+ (void)vf();
+ (void)if1();
+ (void)cf();
+ (const void)bf();
+ /* Casts to the same type or similar types are OK. */
+ (int)if1();
+ (long)if2();
+ (char)if3();
+ (float)rf1();
+ (long double)rf2();
+ (_Complex float)cf();
+ (enum f { F1 })ef();
+ (_Bool)bf();
+ (void *)pf1();
+ (char *)pf2();
+ /* All following casts issue warning */
+ (float)if1(); /* expected-warning {{cast from function call of type 'int' to non-matching type 'float'}} */
+ (double)if2(); /* expected-warning {{cast from function call of type 'char' to non-matching type 'double'}} */
+ (_Bool)if3(); /* expected-warning {{cast from function call of type 'long' to non-matching type '_Bool'}} */
+ (int)rf1(); /* expected-warning {{cast from function call of type 'float' to non-matching type 'int'}} */
+ (long)rf2(); /* expected-warning {{cast from function call of type 'double' to non-matching type 'long'}} */
+ (double)cf(); /* expected-warning {{cast from function call of type '_Complex double' to non-matching type 'double'}} */
+ (int)ef(); /* expected-warning {{cast from function call of type 'enum e' to non-matching type 'int'}} */
+ (int)bf(); /* expected-warning {{cast from function call of type '_Bool' to non-matching type 'int'}} */
+ (__SIZE_TYPE__)pf1(); /* expected-warning {{cast from function call of type 'char *' to non-matching type 'unsigned long'}} */
+ (__PTRDIFF_TYPE__)pf2(); /* expected-warning {{cast from function call of type 'int *' to non-matching type 'long'}} */
+}
+
diff --git a/test/Sema/warn-documentation-fixits.cpp b/test/Sema/warn-documentation-fixits.cpp
index 732b44db027a..a47b77637506 100644
--- a/test/Sema/warn-documentation-fixits.cpp
+++ b/test/Sema/warn-documentation-fixits.cpp
@@ -20,8 +20,52 @@ void test3(T aaa);
template<typename SomeTy, typename OtherTy>
void test4(SomeTy aaa, OtherTy bbb);
+// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+/// \deprecated
+void test_deprecated_1();
+
+// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+/// \deprecated
+void test_deprecated_2(int a);
+
+struct test_deprecated_3 {
+ // expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+ /// \deprecated
+ void test_deprecated_4();
+
+ // expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+ /// \deprecated
+ void test_deprecated_5() {
+ }
+};
+
+template<typename T>
+struct test_deprecated_6 {
+ // expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+ /// \deprecated
+ void test_deprecated_7();
+
+ // expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+ /// \deprecated
+ void test_deprecated_8() {
+ }
+};
+
+#define MY_ATTR_DEPRECATED __attribute__((deprecated))
+
+// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}}
+/// \deprecated
+void test_deprecated_9(int a);
+
// CHECK: fix-it:"{{.*}}":{5:12-5:22}:"a"
// CHECK: fix-it:"{{.*}}":{9:12-9:15}:"aaa"
// CHECK: fix-it:"{{.*}}":{13:13-13:23}:"T"
// CHECK: fix-it:"{{.*}}":{18:13-18:18}:"SomeTy"
+// CHECK: fix-it:"{{.*}}":{25:25-25:25}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{29:30-29:30}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{34:27-34:27}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{38:27-38:27}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{46:27-46:27}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{50:27-50:27}:" __attribute__((deprecated))"
+// CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED"
diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp
index d99520b6733e..5678fd94cb73 100644
--- a/test/Sema/warn-documentation.cpp
+++ b/test/Sema/warn-documentation.cpp
@@ -38,13 +38,13 @@ int test_html7(int);
int test_html8(int);
// expected-warning@+2 {{HTML start tag prematurely ended, expected attribute name or '>'}} expected-note@+1 {{HTML tag started here}}
-/** Aaa bbb<ccc ddd eee
+/** Aaa bbb<img ddd eee
* fff ggg.
*/
int test_html9(int);
// expected-warning@+1 {{HTML start tag prematurely ended, expected attribute name or '>'}}
-/** Aaa bbb<ccc ddd eee 42%
+/** Aaa bbb<img ddd eee 42%
* fff ggg.
*/
int test_html10(int);
@@ -218,9 +218,32 @@ int test_param12(int a);
/// \param aab Blah blah.
int test_param13(int aaa, int bbb);
+// expected-warning@+2 {{parameter 'aab' not found in the function declaration}} expected-note@+2 {{did you mean 'bbb'?}}
+/// \param aaa Blah blah.
+/// \param aab Blah blah.
+int test_param14(int aaa, int bbb);
+
// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
/// \param aab Blah blah.
-int test_param14(int bbb, int ccc);
+int test_param15(int bbb, int ccc);
+
+// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
+/// \param aab Ccc.
+/// \param aaa Aaa.
+/// \param bbb Bbb.
+int test_param16(int aaa, int bbb);
+
+// expected-warning@+2 {{parameter 'aab' not found in the function declaration}}
+/// \param aaa Aaa.
+/// \param aab Ccc.
+/// \param bbb Bbb.
+int test_param17(int aaa, int bbb);
+
+// expected-warning@+3 {{parameter 'aab' not found in the function declaration}}
+/// \param aaa Aaa.
+/// \param bbb Bbb.
+/// \param aab Ccc.
+int test_param18(int aaa, int bbb);
class C {
// expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
@@ -229,26 +252,56 @@ class C {
// expected-warning@+1 {{parameter 'aaa' not found in the function declaration}}
/// \param aaa Blah blah.
- int test_param15(int bbb, int ccc);
+ int test_param19(int bbb, int ccc);
};
// expected-warning@+1 {{parameter 'aab' not found in the function declaration}}
/// \param aab Blah blah.
template<typename T>
-void test_param16(int bbb, int ccc);
+void test_param20(int bbb, int ccc);
// expected-warning@+3 {{parameter 'a' is already documented}}
// expected-note@+1 {{previous documentation}}
/// \param a Aaa.
/// \param a Aaa.
-int test_param17(int a);
+int test_param21(int a);
// expected-warning@+4 {{parameter 'x2' is already documented}}
// expected-note@+2 {{previous documentation}}
/// \param x1 Aaa.
/// \param x2 Bbb.
/// \param x2 Ccc.
-int test_param18(int x1, int x2, int x3);
+int test_param22(int x1, int x2, int x3);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int test_param23(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int (*test_param24)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int (* const test_param25)(int aaa, int ccc);
+
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int (C::*test_param26)(int aaa, int ccc);
+
+typedef int (*test_param27)(int aaa);
+
+// expected-warning@+1 {{'\param' command used in a comment that is not attached to a function declaration}}
+/// \param aaa Meow.
+typedef test_param27 test_param28;
// expected-warning@+1 {{'\tparam' command used in a comment that is not attached to a template declaration}}
@@ -324,6 +377,52 @@ using test_tparam14 = test_tparam13<T, int>;
template<typename T>
using test_tparam15 = test_tparam13<T, int>;
+
+/// Aaa
+/// \deprecated Bbb
+void test_deprecated_1(int a) __attribute__((deprecated));
+
+// We don't want \deprecated to warn about empty paragraph. It is fine to use
+// \deprecated by itself without explanations.
+
+/// Aaa
+/// \deprecated
+void test_deprecated_2(int a) __attribute__((deprecated));
+
+/// Aaa
+/// \deprecated
+void test_deprecated_3(int a) __attribute__((availability(macosx,introduced=10.4)));
+
+/// Aaa
+/// \deprecated
+void test_deprecated_4(int a) __attribute__((unavailable));
+
+// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
+/// Aaa
+/// \deprecated
+void test_deprecated_5(int a);
+
+// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}}
+/// Aaa
+/// \deprecated
+void test_deprecated_6(int a) {
+}
+
+// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}}
+/// Aaa
+/// \deprecated
+template<typename T>
+void test_deprecated_7(T aaa);
+
+
+/// \invariant aaa
+void test_invariant_1(int a);
+
+// expected-warning@+1 {{empty paragraph passed to '\invariant' command}}
+/// \invariant
+void test_invariant_2(int a);
+
+
// no-warning
/// \returns Aaa
int test_returns_right_decl_1(int);
@@ -403,6 +502,24 @@ enum test_returns_wrong_decl_8 {
namespace test_returns_wrong_decl_10 { };
+// expected-warning@+1 {{'\endverbatim' command does not terminate a verbatim text block}}
+/// \endverbatim
+int test_verbatim_1();
+
+// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}}
+/// \endcode
+int test_verbatim_2();
+
+// FIXME: we give a bad diagnostic here because we throw away non-documentation
+// comments early.
+//
+// expected-warning@+3 {{'\endcode' command does not terminate a verbatim text block}}
+/// \code
+// foo
+/// \endcode
+int test_verbatim_3();
+
+
// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
int test1; ///< \brief\author Aaa
@@ -714,3 +831,8 @@ inline void test_nocrash6()
*/
typedef const struct test_nocrash7 * test_nocrash8;
+// We used to crash on this.
+
+/// aaa \unknown aaa \unknown aaa
+int test_nocrash9;
+
diff --git a/test/Sema/warn-documentation.m b/test/Sema/warn-documentation.m
index d6af6edcc85d..8a894dca7003 100644
--- a/test/Sema/warn-documentation.m
+++ b/test/Sema/warn-documentation.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -Wdocumentation-pedantic -verify %s
@class NSString;
@@ -91,3 +91,9 @@ int b;
- (void)test2:(NSString *)aaa;
@end
+// expected-warning@+2 {{parameter 'bbb' not found in the function declaration}} expected-note@+2 {{did you mean 'ccc'?}}
+/// \param aaa Meow.
+/// \param bbb Bbb.
+/// \returns aaa.
+typedef int (^test_param1)(int aaa, int ccc);
+
diff --git a/test/Sema/warn-gnu-designators.c b/test/Sema/warn-gnu-designators.c
index bdb3374288df..e55cfba0c589 100644
--- a/test/Sema/warn-gnu-designators.c
+++ b/test/Sema/warn-gnu-designators.c
@@ -1,2 +1,3 @@
// RUN: %clang_cc1 -Wno-gnu-designator -verify %s
+// expected-no-diagnostics
struct { int x, y, z[12]; } value = { x:17, .z [3 ... 5] = 7 };
diff --git a/test/Sema/warn-missing-variable-declarations.c b/test/Sema/warn-missing-variable-declarations.c
new file mode 100644
index 000000000000..631d3d213b01
--- /dev/null
+++ b/test/Sema/warn-missing-variable-declarations.c
@@ -0,0 +1,18 @@
+// RUN: %clang -Wmissing-variable-declarations -fsyntax-only -Xclang -verify %s
+
+int vbad1; // expected-warning{{no previous extern declaration for non-static variable 'vbad1'}}
+
+int vbad2;
+int vbad2 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad2'}}
+
+struct {
+ int mgood1;
+} vbad3; // expected-warning{{no previous extern declaration for non-static variable 'vbad3'}}
+
+int vbad4;
+int vbad4 = 10; // expected-warning{{no previous extern declaration for non-static variable 'vbad4'}}
+extern int vbad4;
+
+extern int vgood1;
+int vgood1;
+int vgood1 = 10;
diff --git a/test/Sema/warn-type-safety-mpi-hdf5.c b/test/Sema/warn-type-safety-mpi-hdf5.c
index 9c2ee965866d..8c50cb24bb60 100644
--- a/test/Sema/warn-type-safety-mpi-hdf5.c
+++ b/test/Sema/warn-type-safety-mpi-hdf5.c
@@ -147,6 +147,10 @@ void test_mpi_predefined_types(
// Layout-compatible scalar types.
MPI_Send(int_buf, 1, MPI_INT); // no-warning
+ // Null pointer constant.
+ MPI_Send(0, 0, MPI_INT); // no-warning
+ MPI_Send(NULL, 0, MPI_INT); // no-warning
+
// Layout-compatible class types.
MPI_Send(pfi, 1, MPI_FLOAT_INT); // no-warning
MPI_Send(pii, 1, MPI_2INT); // no-warning
diff --git a/test/Sema/warn-type-safety.c b/test/Sema/warn-type-safety.c
index 6f548aa2567d..4ac453d380bd 100644
--- a/test/Sema/warn-type-safety.c
+++ b/test/Sema/warn-type-safety.c
@@ -80,6 +80,14 @@ void test_tag_mismatch(int *ptr)
C_func(ptr, 20); // should warn, but may cause false positives
}
+void test_null_pointer()
+{
+ C_func(0, C_tag); // no-warning
+ C_func((void *) 0, C_tag); // no-warning
+ C_func((int *) 0, C_tag); // no-warning
+ C_func((long *) 0, C_tag); // expected-warning {{argument type 'long *' doesn't match specified 'c' type tag that requires 'int *'}}
+}
+
// Check that we look through typedefs in the special case of allowing 'char'
// to be matched with 'signed char' or 'unsigned char'.
void E_func(void *ptr, int tag) __attribute__(( pointer_with_type_tag(e,1,2) ));
diff --git a/test/Sema/warn-type-safety.cpp b/test/Sema/warn-type-safety.cpp
index d053fbaa21fc..a73a9d9d2acc 100644
--- a/test/Sema/warn-type-safety.cpp
+++ b/test/Sema/warn-type-safety.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
typedef struct ompi_datatype_t *MPI_Datatype;
@@ -52,6 +52,8 @@ void test1(C *c, int *int_buf)
{
c->MPI_Send(int_buf, 1, MPI_INT); // no-warning
c->MPI_Send(int_buf, 1, MPI_FLOAT); // expected-warning {{argument type 'int *' doesn't match specified 'mpi' type tag that requires 'float *'}}
+ c->MPI_Send(0, 0, MPI_INT); // no-warning
+ c->MPI_Send(nullptr, 0, MPI_INT); // no-warning
OperatorIntStar i;
c->MPI_Send(i, 1, MPI_INT); // no-warning
diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c
index 636513f62c70..2fbe1c78eb21 100644
--- a/test/Sema/warn-unreachable.c
+++ b/test/Sema/warn-unreachable.c
@@ -132,3 +132,12 @@ void PR9774(int *s) {
s[i] = 0;
}
+// Test case for <rdar://problem/11005770>. We should treat code guarded
+// by 'x & 0' and 'x * 0' as unreachable.
+void calledFun();
+void test_mul_and_zero(int x) {
+ if (x & 0) calledFun(); // expected-warning {{will never be executed}}
+ if (0 & x) calledFun(); // expected-warning {{will never be executed}}
+ if (x * 0) calledFun(); // expected-warning {{will never be executed}}
+ if (0 * x) calledFun(); // expected-warning {{will never be executed}}
+}
diff --git a/test/Sema/warn-unused-function.c b/test/Sema/warn-unused-function.c
index 8f4cdcba881e..a334e71e5067 100644
--- a/test/Sema/warn-unused-function.c
+++ b/test/Sema/warn-unused-function.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-function -Wunneeded-internal-declaration -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wused-but-marked-unused -Wunused-function -Wunneeded-internal-declaration -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
@@ -54,3 +54,15 @@ void f13(void) {
char * const __attribute__((cleanup(cleanupMalloc))) a;
(void)a;
}
+
+// rdar://12233989
+extern void a(void) __attribute__((unused));
+extern void b(void) __attribute__((unused));
+
+void b(void)
+{
+}
+void a(void)
+{
+ b();
+}
diff --git a/test/Sema/wchar.c b/test/Sema/wchar.c
index 28ec2f14ceb7..8708aa0f65c3 100644
--- a/test/Sema/wchar.c
+++ b/test/Sema/wchar.c
@@ -6,6 +6,8 @@ typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
|| defined(_M_X64) || defined(SHORT_WCHAR)
#define WCHAR_T_TYPE unsigned short
+#elif defined(__arm)
+ #define WCHAR_T_TYPE unsigned int
#elif defined(__sun) || defined(__AuroraUX__)
#define WCHAR_T_TYPE long
#else /* Solaris or AuroraUX. */
diff --git a/test/Sema/weak-import-on-enum.c b/test/Sema/weak-import-on-enum.c
index 3a2c0e5b3a14..ad437693a10e 100644
--- a/test/Sema/weak-import-on-enum.c
+++ b/test/Sema/weak-import-on-enum.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin %s
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://10277579
enum __attribute__((deprecated)) __attribute__((weak_import)) A {