Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions without prototypes. This patch converts the function signatures to have a prototype for the situations where the test is not specific to K&R C declarations. e.g., void func(); becomes void func(void); This is the third batch of tests being updated (there are a significant number of other tests left to be updated).
This commit is contained in:
parent
a70549ae43
commit
22db4824b9
|
@ -1,7 +1,7 @@
|
|||
// Test that this unreachable code warning is
|
||||
// not reported because it is in a header.
|
||||
|
||||
void foo_unreachable_header() {
|
||||
void foo_unreachable_header(void) {
|
||||
return;
|
||||
foo_unreachable_header(); // no-warning
|
||||
}
|
|
@ -10,7 +10,7 @@ enum {
|
|||
Z = 1 << 2
|
||||
};
|
||||
|
||||
void test() {
|
||||
void test(void) {
|
||||
char c;
|
||||
|
||||
c = 0 << 0;
|
||||
|
@ -61,7 +61,7 @@ void test() {
|
|||
enum { b = (a << ashift) };
|
||||
|
||||
// Don't warn for negative shifts in code that is unreachable.
|
||||
void test_pr5544() {
|
||||
void test_pr5544(void) {
|
||||
(void) (((1) > 63 && (1) < 128 ? (((unsigned long long) 1)<<((1)-64)) : (unsigned long long) 0)); // no-warning
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ _Static_assert(IsEqual(__builtin_FILE(), "my_file.c"), "");
|
|||
|
||||
_Static_assert(__builtin_COLUMN() == __builtin_strlen("_Static_assert(_"), "");
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
_Static_assert(IsEqual(__builtin_FUNCTION(), "foo"), "");
|
||||
}
|
||||
#endif // CONST_STRINGS
|
||||
|
|
|
@ -12,13 +12,13 @@ int test(int _x) {
|
|||
}
|
||||
|
||||
// PR2374
|
||||
int test2() { return ({L:5;}); }
|
||||
int test3() { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
|
||||
int test2(void) { return ({L:5;}); }
|
||||
int test3(void) { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
|
||||
// expected-warning {{expression result unused}}
|
||||
int test4() { return ({ ({5;}); }); }
|
||||
int test5() { return ({L1: L2: L3: 5;}); }
|
||||
int test6() { return ({5;}); }
|
||||
void test7() { ({5;}); } // expected-warning {{expression result unused}}
|
||||
int test4(void) { return ({ ({5;}); }); }
|
||||
int test5(void) { return ({L1: L2: L3: 5;}); }
|
||||
int test6(void) { return ({5;}); }
|
||||
void test7(void) { ({5;}); } // expected-warning {{expression result unused}}
|
||||
|
||||
// PR3062
|
||||
int test8[({10;})]; // expected-error {{statement expression not allowed at file scope}}
|
||||
|
@ -29,14 +29,14 @@ void test9(const void *P) {
|
|||
}
|
||||
|
||||
|
||||
void *test10() {
|
||||
void *test10(void) {
|
||||
bar:
|
||||
return &&bar; // expected-warning {{returning address of label, which is local}}
|
||||
}
|
||||
|
||||
// PR38569: Don't warn when returning a label from a statement expression.
|
||||
void test10_logpc(void*);
|
||||
void test10a() {
|
||||
void test10a(void) {
|
||||
test10_logpc(({
|
||||
my_pc:
|
||||
&&my_pc;
|
||||
|
@ -99,7 +99,7 @@ void foo(enum x X) {
|
|||
}
|
||||
}
|
||||
|
||||
int test_pr8880() {
|
||||
int test_pr8880(void) {
|
||||
int first = 1;
|
||||
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
|
||||
return 0;
|
||||
|
@ -108,7 +108,7 @@ int test_pr8880() {
|
|||
|
||||
// In PR22849, we considered __ptr to be a static data member of the anonymous
|
||||
// union. Now we declare it in the parent DeclContext.
|
||||
void test_pr22849() {
|
||||
void test_pr22849(void) {
|
||||
struct Bug {
|
||||
typeof(({ unsigned long __ptr; (int *)(0); })) __val;
|
||||
union Nested {
|
||||
|
@ -122,7 +122,7 @@ void test_pr22849() {
|
|||
|
||||
// GCC ignores empty statements at the end of compound expressions where the
|
||||
// result type is concerned.
|
||||
void test13() {
|
||||
void test13(void) {
|
||||
int a;
|
||||
a = ({ 1; });
|
||||
a = ({1;; });
|
||||
|
@ -130,10 +130,10 @@ void test13() {
|
|||
a = ({int x = 1; (void)x;; }); // expected-error {{assigning to 'int' from incompatible type 'void'}}
|
||||
}
|
||||
|
||||
void test14() { return ({}); }
|
||||
void test15() {
|
||||
void test14(void) { return ({}); }
|
||||
void test15(void) {
|
||||
return ({;;;; });
|
||||
}
|
||||
void test16() {
|
||||
void test16(void) {
|
||||
return ({test:;; });
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-gnu-statement-expression
|
||||
|
||||
int stmtexpr_fn();
|
||||
int stmtexpr_fn(void);
|
||||
void stmtexprs(int i) {
|
||||
__builtin_assume( ({ 1; }) ); // no warning about "side effects"
|
||||
__builtin_assume( ({ if (i) { (void)0; }; 42; }) ); // no warning about "side effects"
|
||||
|
|
|
@ -5,7 +5,7 @@ typedef int wchar_t;
|
|||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
char a1[] = "a"; // No error.
|
||||
char a2[] = u8"a"; // No error.
|
||||
char a3[] = u"a"; // expected-error{{initializing char array with wide string literal}}
|
||||
|
@ -43,7 +43,7 @@ void f() {
|
|||
long f5[] = L"a"; // expected-error{{array initializer must be an initializer list}}
|
||||
}
|
||||
|
||||
void g() {
|
||||
void g(void) {
|
||||
char a[] = 1; // expected-error{{array initializer must be an initializer list or string literal}}
|
||||
wchar_t b[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}}
|
||||
char16_t c[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}}
|
||||
|
|
|
@ -11,6 +11,6 @@ struct S const foo(void);
|
|||
|
||||
struct S tmp;
|
||||
|
||||
void priv_sock_init() {
|
||||
void priv_sock_init(void) {
|
||||
tmp = (struct S)foo();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}}
|
|||
}
|
||||
|
||||
struct x {int a;} r;
|
||||
int b() {
|
||||
int b(void) {
|
||||
struct x {char x;} s = r; // expected-error {{initializing 'struct x' with an expression of incompatible type 'struct x'}}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ struct s {
|
|||
|
||||
struct st;
|
||||
|
||||
int foo() {
|
||||
int foo(void) {
|
||||
struct st *f;
|
||||
return f->v + f[0].v;
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ inline struct test3 { // expected-error {{'inline' can only appear on functions}
|
|||
|
||||
struct hiding_1 {};
|
||||
struct hiding_2 {};
|
||||
void test_hiding() {
|
||||
struct hiding_1 *hiding_1();
|
||||
void test_hiding(void) {
|
||||
struct hiding_1 *hiding_1(void);
|
||||
extern struct hiding_2 *hiding_2;
|
||||
struct hiding_1 *p = hiding_1();
|
||||
struct hiding_2 *q = hiding_2;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
|
||||
// expected-no-diagnostics
|
||||
extern void OldFunction() __attribute__((deprecated));
|
||||
extern void OldFunction(void) __attribute__((deprecated));
|
||||
|
||||
int main (int argc, const char * argv[]) {
|
||||
OldFunction();
|
||||
|
|
|
@ -29,9 +29,9 @@ void test3(void) {
|
|||
// expected-note{{put the semicolon on a separate line to silence this warning}}
|
||||
}
|
||||
|
||||
extern int g();
|
||||
extern int g(void);
|
||||
|
||||
void test4()
|
||||
void test4(void)
|
||||
{
|
||||
int cond;
|
||||
switch (cond) {
|
||||
|
@ -73,7 +73,7 @@ void test5(int z) {
|
|||
}
|
||||
}
|
||||
|
||||
void test6() {
|
||||
void test6(void) {
|
||||
char ch = 'a';
|
||||
switch(ch) {
|
||||
case 1234: // expected-warning {{overflow converting case value}}
|
||||
|
@ -92,7 +92,7 @@ int f0(int var) {
|
|||
return 2;
|
||||
}
|
||||
|
||||
void test7() {
|
||||
void test7(void) {
|
||||
enum {
|
||||
A = 1,
|
||||
B
|
||||
|
@ -139,7 +139,7 @@ void test7() {
|
|||
|
||||
}
|
||||
|
||||
void test8() {
|
||||
void test8(void) {
|
||||
enum {
|
||||
A,
|
||||
B,
|
||||
|
@ -161,7 +161,7 @@ void test8() {
|
|||
}
|
||||
}
|
||||
|
||||
void test9() {
|
||||
void test9(void) {
|
||||
enum {
|
||||
A = 3,
|
||||
C = 1
|
||||
|
@ -176,7 +176,7 @@ void test9() {
|
|||
}
|
||||
}
|
||||
|
||||
void test10() {
|
||||
void test10(void) {
|
||||
enum {
|
||||
A = 10,
|
||||
C = 2,
|
||||
|
@ -196,7 +196,7 @@ void test10() {
|
|||
}
|
||||
}
|
||||
|
||||
void test11() {
|
||||
void test11(void) {
|
||||
enum {
|
||||
A = -1,
|
||||
B,
|
||||
|
@ -218,7 +218,7 @@ void test11() {
|
|||
}
|
||||
}
|
||||
|
||||
void test12() {
|
||||
void test12(void) {
|
||||
enum {
|
||||
A = -1,
|
||||
B = 4294967286
|
||||
|
@ -268,7 +268,7 @@ void f1(unsigned x) {
|
|||
}
|
||||
}
|
||||
|
||||
void test15() {
|
||||
void test15(void) {
|
||||
int i = 0;
|
||||
switch (1) { // expected-warning {{no case matching constant switch condition '1'}}
|
||||
case 0: i = 0; break;
|
||||
|
@ -276,7 +276,7 @@ void test15() {
|
|||
}
|
||||
}
|
||||
|
||||
void test16() {
|
||||
void test16(void) {
|
||||
const char c = '5';
|
||||
switch (c) { // expected-warning {{no case matching constant switch condition '53'}}
|
||||
case '6': return;
|
||||
|
@ -305,7 +305,7 @@ void test17(int x) {
|
|||
}
|
||||
}
|
||||
|
||||
int test18() {
|
||||
int test18(void) {
|
||||
enum { A, B } a;
|
||||
switch (a) {
|
||||
case A: return 0;
|
||||
|
|
|
@ -43,7 +43,7 @@ void TFunc() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
TFunc<unsigned char>();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -Wtype-limits -verify %s
|
||||
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -DSILENCE -Wno-type-limits -verify %s
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
enum A { A_a = 2 };
|
||||
enum A a;
|
||||
|
||||
|
@ -248,7 +248,7 @@ int main() {
|
|||
}
|
||||
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=35009
|
||||
int PR35009() {
|
||||
int PR35009(void) {
|
||||
enum A { A_a = 2 };
|
||||
enum A a;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ typedef signed char BOOL;
|
|||
|
||||
BOOL B;
|
||||
|
||||
void test() {
|
||||
void test(void) {
|
||||
int r;
|
||||
r = B > 0;
|
||||
r = B > 1; // expected-warning {{result of comparison of constant 1 with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// Then default enum sigdness is target-specific.
|
||||
// On windows, it is signed by default. We do not want to warn in that case.
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
enum A { A_a = 0 };
|
||||
enum A a;
|
||||
enum B { B_a = -1 };
|
||||
|
|
|
@ -31,7 +31,7 @@ void TFunc() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
TFunc<unsigned char>();
|
||||
|
|
|
@ -48,7 +48,7 @@ int redef[10];
|
|||
int redef[]; // expected-note {{previous definition is here}}
|
||||
int redef[11]; // expected-error{{redefinition of 'redef'}}
|
||||
|
||||
void func() {
|
||||
void func(void) {
|
||||
extern int i6; // expected-note {{previous declaration is here}}
|
||||
static int i6; // expected-error{{static declaration of 'i6' follows non-static declaration}}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ struct t5 { __thread int x; }; // thread-local-warning {{'_Thread_local' is a C1
|
|||
// expected-error@-5 {{type name does not allow storage class to be specified}}
|
||||
#endif
|
||||
|
||||
__thread int t6(); // thread-local-warning {{'_Thread_local' is a C11 extension}}
|
||||
__thread int t6(void); // thread-local-warning {{'_Thread_local' is a C11 extension}}
|
||||
#if defined(GNU)
|
||||
// expected-error@-2 {{'__thread' is only allowed on variable declarations}}
|
||||
#elif defined(C11) || defined(C99)
|
||||
|
@ -89,14 +89,14 @@ int *thread_int_ptr = &thread_int;
|
|||
#ifndef __cplusplus
|
||||
// expected-error@-2 {{initializer element is not a compile-time constant}}
|
||||
#endif
|
||||
void g() {
|
||||
void g(void) {
|
||||
int *p = &thread_int; // This is perfectly fine, though.
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
constexpr int *thread_int_ptr_2 = &thread_int; // expected-error {{must be initialized by a constant expression}}
|
||||
#endif
|
||||
|
||||
int non_const();
|
||||
int non_const(void);
|
||||
__thread int non_const_init = non_const(); // thread-local-warning {{'_Thread_local' is a C11 extension}}
|
||||
#if !defined(__cplusplus)
|
||||
// expected-error@-2 {{initializer element is not a compile-time constant}}
|
||||
|
|
|
@ -8,7 +8,7 @@ typedef union {
|
|||
|
||||
extern int wait (__WAIT_STATUS __stat_loc);
|
||||
|
||||
void fastcgi_cleanup() {
|
||||
void fastcgi_cleanup(void) {
|
||||
int status = 0;
|
||||
wait(&status);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
int array[10];
|
||||
int *ptr;
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
memset(array, sizeof(array), 0); // expected-warning{{'size' argument to memset is '0'; did you mean to transpose the last two arguments?}} expected-note{{parenthesize the third argument to silence}}
|
||||
memset(array, sizeof(array), 0xff); // expected-warning{{setting buffer to a 'sizeof' expression; did you mean to transpose the last two arguments?}} expected-note{{cast the second argument to 'int' to silence}} expected-warning{{'memset' will always overflow; destination buffer has size 40, but size argument is 255}}
|
||||
memset(ptr, sizeof(ptr), 0); // expected-warning{{'size' argument to memset is '0'; did you mean to transpose the last two arguments?}} expected-note{{parenthesize the third argument to silence}}
|
||||
|
@ -28,7 +28,7 @@ int main() {
|
|||
real_bzero(ptr, 0); // expected-warning{{'size' argument to bzero is '0'}} expected-note{{parenthesize the second argument to silence}}
|
||||
}
|
||||
|
||||
void macros() {
|
||||
void macros(void) {
|
||||
#define ZERO 0
|
||||
int array[10];
|
||||
memset(array, 0xff, ZERO); // no warning
|
||||
|
|
|
@ -14,7 +14,7 @@ void test2(float4 a, int4p result, int i) {
|
|||
|
||||
// PR2039
|
||||
typedef int a[5];
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
typedef const a b;
|
||||
b r; // expected-note {{variable 'r' declared const here}}
|
||||
r[0] = 10; // expected-error {{cannot assign to variable 'r' with const-qualified type 'b' (aka 'const int[5]')}}
|
||||
|
|
|
@ -16,11 +16,11 @@ struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' has
|
|||
typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' has been explicitly marked deprecated here}}
|
||||
bar x1; // expected-warning {{'bar' is deprecated}}
|
||||
|
||||
int main() { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
|
||||
int main(void) { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
|
||||
|
||||
struct gorf { int x; };
|
||||
typedef struct gorf T __attribute__((deprecated)); // expected-note {{'T' has been explicitly marked deprecated here}}
|
||||
T t; // expected-warning {{'T' is deprecated}}
|
||||
void wee() { typeof(t) y; }
|
||||
void wee(void) { typeof(t) y; }
|
||||
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@ restrict S y; // expected-error {{restrict requires a pointer or reference ('S'
|
|||
|
||||
|
||||
// int128_t is available.
|
||||
int a() {
|
||||
int a(void) {
|
||||
__int128_t s;
|
||||
__uint128_t t;
|
||||
}
|
||||
// but not a keyword
|
||||
int b() {
|
||||
int b(void) {
|
||||
int __int128_t;
|
||||
int __uint128_t;
|
||||
}
|
||||
// __int128 is a keyword
|
||||
int c() {
|
||||
int c(void) {
|
||||
__int128 i;
|
||||
unsigned __int128 j;
|
||||
long unsigned __int128 k; // expected-error {{'long __int128' is invalid}}
|
||||
|
@ -88,7 +88,7 @@ int x4 __attribute__((ext_vector_type(64))); // expected-error {{'ext_vector_ty
|
|||
// rdar://16492792
|
||||
typedef __attribute__ ((ext_vector_type(32),__aligned__(32))) unsigned char uchar32;
|
||||
|
||||
void convert() {
|
||||
void convert(void) {
|
||||
uchar32 r = 0;
|
||||
r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ int v_63;
|
|||
|
||||
void v_2_0(int v_452, int v_454) {}
|
||||
|
||||
int v_3_0() {
|
||||
int v_3_0(void) {
|
||||
for (int v_345 = 0 ; v_63;)
|
||||
v_2_0(v_195, // expected-error {{use of undeclared identifier 'v_195'}}
|
||||
v_231); // expected-error {{use of undeclared identifier 'v_231'}}
|
||||
|
@ -24,4 +24,4 @@ int g_109;
|
|||
|
||||
struct a g_999;
|
||||
struct a g_998;
|
||||
void PR50797() { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'}}
|
||||
void PR50797(void) { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'}}
|
||||
|
|
|
@ -11,7 +11,7 @@ int g_109;
|
|||
|
||||
struct a g_999; // expected-note 4{{'g_999' declared here}}
|
||||
|
||||
void b() { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}}
|
||||
void b(void) { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}}
|
||||
|
||||
void c() { (g_910.xxx = g_910.xxx1); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}} \
|
||||
expected-error {{no member named 'xxx1' in 'struct a'; did you mean 'xxx'}}
|
||||
void c(void) { (g_910.xxx = g_910.xxx1); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}} \
|
||||
expected-error {{no member named 'xxx1' in 'struct a'; did you mean 'xxx'}}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
__typeof__(struct F*) var[invalid]; // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}
|
||||
|
||||
void PR21656() {
|
||||
void PR21656(void) {
|
||||
float x;
|
||||
x = (float)arst; // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
|
||||
}
|
||||
|
@ -46,19 +46,19 @@ void f(long *a, long b) {
|
|||
}
|
||||
|
||||
extern double cabs(_Complex double z);
|
||||
void fn1() {
|
||||
void fn1(void) {
|
||||
cabs(errij); // expected-error {{use of undeclared identifier 'errij'}}
|
||||
}
|
||||
|
||||
extern long afunction(int);
|
||||
void fn2() {
|
||||
void fn2(void) {
|
||||
f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 'THIS_IS_AN_ERROR'}}
|
||||
afunction(afunction_)); // expected-error {{use of undeclared identifier 'afunction_'}}
|
||||
}
|
||||
|
||||
int d = X ? d : L; // expected-error 2 {{use of undeclared identifier}}
|
||||
|
||||
int fn_with_ids() { ID = ID == ID >= ID ; } // expected-error 4 {{use of undeclared identifier}}
|
||||
int fn_with_ids(void) { ID = ID == ID >= ID ; } // expected-error 4 {{use of undeclared identifier}}
|
||||
|
||||
int fn_with_rs(int r) { r = TYPO + r * TYPO; } // expected-error 2 {{use of undeclared identifier}}
|
||||
|
||||
|
@ -76,7 +76,7 @@ int g(int x, int y) {
|
|||
return x + y;
|
||||
}
|
||||
|
||||
int h() {
|
||||
int h(void) {
|
||||
g(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
|
||||
(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ struct rdar38642201 {
|
|||
};
|
||||
|
||||
void rdar38642201_callee(int x, int y);
|
||||
void rdar38642201_caller() {
|
||||
void rdar38642201_caller(void) {
|
||||
struct rdar38642201 structVar;
|
||||
rdar38642201_callee(
|
||||
structVar1.fieldName1.member1, //expected-error{{use of undeclared identifier 'structVar1'}}
|
||||
|
|
|
@ -12,7 +12,7 @@ extern void \U000000FCber(int); // redeclaration, no warning
|
|||
// expected-note@-4 + {{declared here}}
|
||||
#endif
|
||||
|
||||
void goodCalls() {
|
||||
void goodCalls(void) {
|
||||
\u00FCber(0);
|
||||
\u00fcber(1);
|
||||
über(2);
|
||||
|
@ -20,7 +20,7 @@ void goodCalls() {
|
|||
\u{FC}ber(4); // expected-warning {{Clang extension}}
|
||||
}
|
||||
|
||||
void badCalls() {
|
||||
void badCalls(void) {
|
||||
\u00FCber(0.5); // expected-warning{{implicit conversion from 'double' to 'int'}}
|
||||
\u00fcber = 0; // expected-error{{non-object type 'void (int)' is not assignable}}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ struct S {
|
|||
|
||||
struct S s[]; // expected-warning {{tentative array definition}} expected-note {{declared here}} addr16-note {{declared here}}
|
||||
|
||||
void f1() {
|
||||
void f1(void) {
|
||||
++s[3].a;
|
||||
++s[7073650413200313099].b;
|
||||
// addr16-warning@-1 {{array index 7073650413200313099 refers past the last possible element for an array in 16-bit address space containing 160-bit (20-byte) elements (max possible 3276 elements)}}
|
||||
|
@ -23,7 +23,7 @@ void f1() {
|
|||
|
||||
long long ll[]; // expected-warning {{tentative array definition}} expected-note {{declared here}} addr16-note {{declared here}} addr32-note {{declared here}}
|
||||
|
||||
void f2() {
|
||||
void f2(void) {
|
||||
++ll[3];
|
||||
++ll[2705843009213693952];
|
||||
// addr16-warning@-1 {{array index 2705843009213693952 refers past the last possible element for an array in 16-bit address space containing 64-bit (8-byte) elements (max possible 8192 elements)}}
|
||||
|
@ -60,13 +60,13 @@ struct BQ {
|
|||
|
||||
struct BQ bq[]; // expected-warning {{tentative array definition}} addr16-note {{declared here}}
|
||||
|
||||
void f5() {
|
||||
void f5(void) {
|
||||
++bq[0].bigblock[0].a;
|
||||
++bq[1].bigblock[0].a;
|
||||
// addr16-warning@-1 {{array index 1 refers past the last possible element for an array in 16-bit address space containing 524160-bit (65520-byte) elements (max possible 1 element)}}
|
||||
}
|
||||
|
||||
void f6() {
|
||||
void f6(void) {
|
||||
int ints[] = {1, 3, 5, 7, 8, 6, 4, 5, 9};
|
||||
int const n_ints = sizeof(ints) / sizeof(int);
|
||||
unsigned long long const N = 3;
|
||||
|
@ -76,7 +76,7 @@ void f6() {
|
|||
*(middle + 5 - N) = 22;
|
||||
}
|
||||
|
||||
void pr50741() {
|
||||
void pr50741(void) {
|
||||
(void *)0 + 0xdead000000000000UL;
|
||||
// no array-bounds warning, and no crash
|
||||
}
|
||||
|
|
|
@ -4,35 +4,35 @@
|
|||
typedef __typeof(sizeof(int)) size_t;
|
||||
void *malloc(size_t);
|
||||
|
||||
int test1() {
|
||||
int test1(void) {
|
||||
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
int test2() {
|
||||
int test2(void) {
|
||||
int x = 0;
|
||||
return x; // no-warning
|
||||
}
|
||||
|
||||
int test3() {
|
||||
int test3(void) {
|
||||
int x;
|
||||
x = 0;
|
||||
return x; // no-warning
|
||||
}
|
||||
|
||||
int test4() {
|
||||
int test4(void) {
|
||||
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
++x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
return x;
|
||||
}
|
||||
|
||||
int test5() {
|
||||
int test5(void) {
|
||||
int x, y; // expected-note{{initialize the variable 'y' to silence this warning}}
|
||||
x = y; // expected-warning{{variable 'y' is uninitialized when used here}}
|
||||
return x;
|
||||
}
|
||||
|
||||
int test6() {
|
||||
int test6(void) {
|
||||
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
x += 2; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
return x;
|
||||
|
@ -95,22 +95,22 @@ void test12(unsigned n) {
|
|||
for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' is uninitialized when used here}} expected-note{{initialize the variable 'i' to silence this warning}}
|
||||
}
|
||||
|
||||
int test13() {
|
||||
int test13(void) {
|
||||
static int i;
|
||||
return i; // no-warning
|
||||
}
|
||||
|
||||
// Simply don't crash on this test case.
|
||||
void test14() {
|
||||
void test14(void) {
|
||||
const char *p = 0;
|
||||
for (;;) {}
|
||||
}
|
||||
|
||||
void test15() {
|
||||
void test15(void) {
|
||||
int x = x; // no-warning: signals intended lack of initialization.
|
||||
}
|
||||
|
||||
int test15b() {
|
||||
int test15b(void) {
|
||||
// Warn here with the self-init, since it does result in a use of
|
||||
// an uninitialized variable and this is the root cause.
|
||||
int x = x; // expected-warning {{variable 'x' is uninitialized when used within its own initialization}}
|
||||
|
@ -118,14 +118,14 @@ int test15b() {
|
|||
}
|
||||
|
||||
// Don't warn in the following example; shows dataflow confluence.
|
||||
char *test16_aux();
|
||||
void test16() {
|
||||
char *test16_aux(void);
|
||||
void test16(void) {
|
||||
char *p = test16_aux();
|
||||
for (unsigned i = 0 ; i < 100 ; i++)
|
||||
p[i] = 'a'; // no-warning
|
||||
}
|
||||
|
||||
void test17() {
|
||||
void test17(void) {
|
||||
// Don't warn multiple times about the same uninitialized variable
|
||||
// along the same path.
|
||||
int *x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
|
@ -141,17 +141,17 @@ int test18(int x, int y) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test19_aux1();
|
||||
int test19_aux2();
|
||||
int test19_aux1(void);
|
||||
int test19_aux2(void);
|
||||
int test19_aux3(int *x);
|
||||
int test19() {
|
||||
int test19(void) {
|
||||
int z;
|
||||
if (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
|
||||
return z; // no-warning
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test20() {
|
||||
int test20(void) {
|
||||
int z; // expected-note{{initialize the variable 'z' to silence this warning}}
|
||||
if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z)) // expected-warning {{variable 'z' is used uninitialized whenever '||' condition is true}} expected-note {{remove the '||' if its condition is always false}}
|
||||
return z; // expected-note {{uninitialized use occurs here}}
|
||||
|
@ -165,14 +165,14 @@ int test21(int x, int y) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test22() {
|
||||
int test22(void) {
|
||||
int z;
|
||||
while (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
|
||||
return z; // no-warning
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test23() {
|
||||
int test23(void) {
|
||||
int z;
|
||||
for ( ; test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z) ; )
|
||||
return z; // no-warning
|
||||
|
@ -192,54 +192,54 @@ int test24(int flag) {
|
|||
return val; // expected-warning{{variable 'val' may be uninitialized when used here}}
|
||||
}
|
||||
|
||||
float test25() {
|
||||
float test25(void) {
|
||||
float x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
typedef int MyInt;
|
||||
MyInt test26() {
|
||||
MyInt test26(void) {
|
||||
MyInt x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
// Test handling of sizeof().
|
||||
int test27() {
|
||||
int test27(void) {
|
||||
struct test_27 { int x; } *y;
|
||||
return sizeof(y->x); // no-warning
|
||||
}
|
||||
|
||||
int test28() {
|
||||
int test28(void) {
|
||||
int len; // expected-note{{initialize the variable 'len' to silence this warning}}
|
||||
return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
void test29() {
|
||||
void test29(void) {
|
||||
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
(void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}}
|
||||
}
|
||||
|
||||
void test30() {
|
||||
void test30(void) {
|
||||
static int x; // no-warning
|
||||
(void) ^{ (void) x; };
|
||||
}
|
||||
|
||||
void test31() {
|
||||
void test31(void) {
|
||||
__block int x; // no-warning
|
||||
(void) ^{ (void) x; };
|
||||
}
|
||||
|
||||
int test32_x;
|
||||
void test32() {
|
||||
void test32(void) {
|
||||
(void) ^{ (void) test32_x; }; // no-warning
|
||||
}
|
||||
|
||||
void test_33() {
|
||||
void test_33(void) {
|
||||
int x; // no-warning
|
||||
(void) x;
|
||||
}
|
||||
|
||||
int test_34() {
|
||||
int test_34(void) {
|
||||
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
|
||||
(void) x;
|
||||
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
|
||||
|
@ -252,7 +252,7 @@ void test35(int x) {
|
|||
}
|
||||
|
||||
// Test handling of indirect goto.
|
||||
void test36()
|
||||
void test36(void)
|
||||
{
|
||||
void **pc; // expected-note{{initialize the variable 'pc' to silence this warning}}
|
||||
void *dummy[] = { &&L1, &&L2 };
|
||||
|
@ -263,9 +263,9 @@ void test36()
|
|||
}
|
||||
|
||||
// Test && nested in ||.
|
||||
int test37_a();
|
||||
int test37_b();
|
||||
int test37()
|
||||
int test37_a(void);
|
||||
int test37_b(void);
|
||||
int test37(void)
|
||||
{
|
||||
int identifier;
|
||||
if ((test37_a() && (identifier = 1)) ||
|
||||
|
@ -301,7 +301,7 @@ int test41(int x) {
|
|||
return y; // expected-note{{uninitialized use occurs here}}
|
||||
}
|
||||
|
||||
void test42() {
|
||||
void test42(void) {
|
||||
int a;
|
||||
a = 30; // no-warning
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ int test45(int j) {
|
|||
return y;
|
||||
}
|
||||
|
||||
void test46()
|
||||
void test46(void)
|
||||
{
|
||||
int i; // expected-note{{initialize the variable 'i' to silence this warning}}
|
||||
int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}}
|
||||
|
@ -346,7 +346,7 @@ void *test49(int *i)
|
|||
return &a ? : i; // no-warning
|
||||
}
|
||||
|
||||
void test50()
|
||||
void test50(void)
|
||||
{
|
||||
char c[1 ? : 2]; // no-warning
|
||||
}
|
||||
|
@ -374,13 +374,13 @@ int test52(int a, int b) {
|
|||
return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
|
||||
}
|
||||
|
||||
void test53() {
|
||||
void test53(void) {
|
||||
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
|
||||
int y = (x); // expected-warning {{variable 'x' is uninitialized when used here}}
|
||||
}
|
||||
|
||||
// This CFG caused the uninitialized values warning to inf-loop.
|
||||
extern int PR10379_g();
|
||||
extern int PR10379_g(void);
|
||||
void PR10379_f(int *len) {
|
||||
int new_len; // expected-note{{initialize the variable 'new_len' to silence this warning}}
|
||||
for (int i = 0; i < 42 && PR10379_g() == 0; i++) {
|
||||
|
@ -401,7 +401,7 @@ void test_vla_sizeof(int x) {
|
|||
|
||||
// Test absurd case of deadcode + use of blocks. This previously was a false positive
|
||||
// due to an analysis bug.
|
||||
int test_block_and_dead_code() {
|
||||
int test_block_and_dead_code(void) {
|
||||
__block int x;
|
||||
^{ x = 1; }();
|
||||
if (0)
|
||||
|
@ -432,7 +432,7 @@ void rdar9432305(float *P) {
|
|||
// Test that fixits are not emitted inside macros.
|
||||
#define UNINIT(T, x, y) T x; T y = x;
|
||||
#define ASSIGN(T, x, y) T y = x;
|
||||
void test54() {
|
||||
void test54(void) {
|
||||
UNINIT(int, a, b); // expected-warning {{variable 'a' is uninitialized when used here}} \
|
||||
// expected-note {{variable 'a' is declared here}}
|
||||
int c; // expected-note {{initialize the variable 'c' to silence this warning}}
|
||||
|
@ -443,7 +443,7 @@ void test54() {
|
|||
struct { struct { void *p; } a; } test55 = { { &test55.a }}; // no-warning
|
||||
struct { struct { void *p; } a; } test56 = { { &(test56.a) }}; // no-warning
|
||||
|
||||
void uninit_in_loop() {
|
||||
void uninit_in_loop(void) {
|
||||
int produce(void);
|
||||
void consume(int);
|
||||
for (int n = 0; n < 100; ++n) {
|
||||
|
@ -453,7 +453,7 @@ void uninit_in_loop() {
|
|||
}
|
||||
}
|
||||
|
||||
void uninit_in_loop_goto() {
|
||||
void uninit_in_loop_goto(void) {
|
||||
int produce(void);
|
||||
void consume(int);
|
||||
for (int n = 0; n < 100; ++n) {
|
||||
|
@ -473,7 +473,7 @@ extern int setjmp(jmp_buf env); // implicitly returns_twice
|
|||
|
||||
void do_stuff_and_longjmp(jmp_buf env, int *result) __attribute__((noreturn));
|
||||
|
||||
int returns_twice() {
|
||||
int returns_twice(void) {
|
||||
int a; // expected-note {{initialize}}
|
||||
if (!a) { // expected-warning {{variable 'a' is uninitialized}}
|
||||
jmp_buf env;
|
||||
|
@ -494,12 +494,12 @@ int compound_assign(int *arr, int n) {
|
|||
return sum / n;
|
||||
}
|
||||
|
||||
int compound_assign_2() {
|
||||
int compound_assign_2(void) {
|
||||
int x; // expected-note {{initialize}}
|
||||
return x += 1; // expected-warning {{variable 'x' is uninitialized}}
|
||||
}
|
||||
|
||||
int compound_assign_3() {
|
||||
int compound_assign_3(void) {
|
||||
int x; // expected-note {{initialize}}
|
||||
x *= 0; // expected-warning {{variable 'x' is uninitialized}}
|
||||
return x;
|
||||
|
@ -510,7 +510,7 @@ int self_init_in_cond(int *p) {
|
|||
return n;
|
||||
}
|
||||
|
||||
void test_analyzer_noreturn_aux() __attribute__((analyzer_noreturn));
|
||||
void test_analyzer_noreturn_aux(void) __attribute__((analyzer_noreturn));
|
||||
|
||||
void test_analyzer_noreturn(int y) {
|
||||
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
|
||||
|
|
|
@ -28,8 +28,8 @@ void bar(volatile int *VP, int *P, int A,
|
|||
sqrt(A); // expected-warning {{ignoring return value of function declared with const attribute}}
|
||||
}
|
||||
|
||||
extern void t1();
|
||||
extern void t2();
|
||||
extern void t1(void);
|
||||
extern void t2(void);
|
||||
void t3(int c) {
|
||||
c ? t1() : t2();
|
||||
}
|
||||
|
@ -75,16 +75,16 @@ void t4(int a) {
|
|||
|
||||
// rdar://7186119
|
||||
int t5f(void) __attribute__((warn_unused_result));
|
||||
void t5() {
|
||||
void t5(void) {
|
||||
t5f(); // expected-warning {{ignoring return value of function declared with 'warn_unused_result' attribute}}
|
||||
}
|
||||
|
||||
|
||||
int fn1() __attribute__ ((warn_unused_result));
|
||||
int fn1(void) __attribute__ ((warn_unused_result));
|
||||
int fn2() __attribute__ ((pure));
|
||||
int fn3() __attribute__ ((__const));
|
||||
// rdar://6587766
|
||||
int t6() {
|
||||
int t6(void) {
|
||||
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
|
||||
return -1;
|
||||
|
||||
|
@ -100,15 +100,15 @@ int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_
|
|||
|
||||
// PR4010
|
||||
int (*fn4)(void) __attribute__ ((warn_unused_result));
|
||||
void t8() {
|
||||
void t8(void) {
|
||||
fn4(); // expected-warning {{ignoring return value of function declared with 'warn_unused_result' attribute}}
|
||||
}
|
||||
|
||||
void t9() __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
|
||||
void t9(void) __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
|
||||
|
||||
// rdar://7410924
|
||||
void *some_function(void);
|
||||
void t10() {
|
||||
void t10(void) {
|
||||
(void*) some_function(); //expected-warning {{expression result unused; should this cast be to 'void'?}}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void f(int i, ...) {
|
|||
}
|
||||
|
||||
// PR8371
|
||||
int fn5() __attribute__ ((__const));
|
||||
int fn5(void) __attribute__ ((__const));
|
||||
|
||||
// Don't warn for unused expressions in macro bodies; however, do warn for
|
||||
// unused expressions in macro arguments. Macros below are reduced from code
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -triple=i686-pc-linux-gnu %s
|
||||
|
||||
int a() {
|
||||
int a(void) {
|
||||
__builtin_va_arg((char*)0, int); // expected-error {{expression is not assignable}}
|
||||
__builtin_va_arg((void*){0}, int); // expected-error {{first argument to 'va_arg' is of type 'void *'}}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ int outer5;
|
|||
int outer6(float); // expected-note{{previous definition is here}}
|
||||
int outer7(float);
|
||||
|
||||
void outer_test() {
|
||||
void outer_test(void) {
|
||||
extern float outer1; // expected-error{{redeclaration of 'outer1' with a different type}}
|
||||
extern float outer2; // expected-error{{redeclaration of 'outer2' with a different type}}
|
||||
extern float outer3; // expected-note{{previous declaration is here}}
|
||||
|
@ -30,7 +30,7 @@ int outer8(int); // expected-error{{redefinition of 'outer8' as different kind o
|
|||
float outer9; // expected-error{{redefinition of 'outer9' with a different type}}
|
||||
|
||||
extern int outer13; // expected-note{{previous declaration is here}}
|
||||
void outer_shadowing_test() {
|
||||
void outer_shadowing_test(void) {
|
||||
extern int outer10;
|
||||
extern int outer11; // expected-note{{previous declaration is here}}
|
||||
extern int outer12; // expected-note{{previous declaration is here}}
|
||||
|
@ -66,5 +66,5 @@ void f(int x) { // expected-note {{previous definition is here}}
|
|||
}
|
||||
|
||||
extern int b[];
|
||||
void g20() { extern int b[3]; } // expected-note{{previous declaration is here}}
|
||||
void g21() { extern int b[4]; } // expected-error{{redeclaration of 'b' with a different type: 'int[4]' vs 'int[3]'}}
|
||||
void g20(void) { extern int b[3]; } // expected-note{{previous declaration is here}}
|
||||
void g21(void) { extern int b[4]; } // expected-error{{redeclaration of 'b' with a different type: 'int[4]' vs 'int[3]'}}
|
||||
|
|
|
@ -5,7 +5,7 @@ typedef struct __CFError * CFErrorRef; // expected-note {{forward declaration of
|
|||
|
||||
void junk(int, ...);
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
CFErrorRef error;
|
||||
junk(1, *error, (void)0); // expected-error {{argument type 'struct __CFError' is incomplete}} \
|
||||
|
|
|
@ -50,7 +50,7 @@ vector_uchar4 vuc4;
|
|||
vector_ushort4 vus4;
|
||||
vector_uint4 vui4;
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
vc8 = 1 << vc8;
|
||||
vuc8 = 1 << vuc8;
|
||||
vi8 = 1 << vi8;
|
||||
|
|
|
@ -5,7 +5,7 @@ typedef signed int v1s __attribute__ ((vector_size (4)));
|
|||
typedef float v2f __attribute__ ((vector_size(8)));
|
||||
typedef signed short v4ss __attribute__ ((vector_size (8)));
|
||||
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
v2s v1;
|
||||
v2u v2;
|
||||
v1s v3;
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef short s2 __attribute__ ((vector_size(4)));
|
|||
|
||||
typedef enum { Evalue = 0x10000 } E;
|
||||
|
||||
void f()
|
||||
void f(void)
|
||||
{
|
||||
t1 v1;
|
||||
t2 v2;
|
||||
|
@ -52,7 +52,7 @@ typedef float float16 __attribute__((__vector_size__(16)));
|
|||
typedef signed int vSInt32 __attribute__((__vector_size__(16)));
|
||||
typedef unsigned int vUInt32 __attribute__((__vector_size__(16)));
|
||||
|
||||
void f4() {
|
||||
void f4(void) {
|
||||
float2 f2;
|
||||
double d, a, b, c;
|
||||
float64x2_t v = {0.0, 1.0};
|
||||
|
@ -70,7 +70,7 @@ void f4() {
|
|||
// rdar://15931426
|
||||
// Don't permit a lax conversion to and from a pointer type.
|
||||
typedef short short_sizeof_pointer __attribute__((vector_size(sizeof(void*))));
|
||||
void f5() {
|
||||
void f5(void) {
|
||||
short_sizeof_pointer v;
|
||||
void *ptr;
|
||||
v = ptr; // expected-error-re {{assigning to 'short_sizeof_pointer' (vector of {{[0-9]+}} 'short' values) from incompatible type 'void *'}}
|
||||
|
|
|
@ -37,7 +37,7 @@ int test2[sizeof(float3) == sizeof(float4) ? 1 : -1];
|
|||
typedef long long __attribute__((vector_size(16))) longlong2;
|
||||
typedef short __attribute__((vector_size(16))) short8;
|
||||
typedef short __attribute__((vector_size(8))) short4;
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
extern short8 test3_helper(void);
|
||||
longlong2 arr1[2] = { test3_helper(), test3_helper() };
|
||||
short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' (vector of 4 'short' values) with an expression of incompatible type 'short8' (vector of 8 'short' values)}}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
typedef float float8 __attribute__((ext_vector_type(8)));
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
float8 f2 = (float8){0, 0, 0, 0, 0, 0, 0, 0};
|
||||
(void)f2.s01234;
|
||||
(void)f2.xyzxy;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
|
||||
|
||||
int test1() {
|
||||
int test1(void) {
|
||||
typedef int x[test1()]; // vla
|
||||
static int y = sizeof(x); // expected-error {{not a compile-time constant}}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ int d[i]; // expected-error {{variable length array declaration not allowed at f
|
|||
|
||||
int (*e)[i]; // expected-error {{variably modified type declaration not allowed at file scope}}
|
||||
|
||||
void f3()
|
||||
void f3(void)
|
||||
{
|
||||
static int a[i]; // expected-error {{variable length array declaration cannot have 'static' storage duration}}
|
||||
extern int b[i]; // expected-error {{variable length array declaration cannot have 'extern' linkage}}
|
||||
|
@ -53,7 +53,7 @@ int pr2044b;
|
|||
int (*pr2044c(void))[pr2044b]; // expected-error {{variably modified type}}
|
||||
|
||||
const int f5_ci = 1;
|
||||
void f5() { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}}
|
||||
void f5(void) { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}}
|
||||
|
||||
// PR5185
|
||||
void pr5185(int a[*]);
|
||||
|
@ -75,7 +75,7 @@ struct {
|
|||
implicitly_declared() // expected-warning {{implicit declaration}}
|
||||
];
|
||||
};
|
||||
int (*use_implicitly_declared)() = implicitly_declared; // ok, was implicitly declared at file scope
|
||||
int (*use_implicitly_declared)(void) = implicitly_declared; // ok, was implicitly declared at file scope
|
||||
|
||||
void VLAPtrAssign(int size) {
|
||||
int array[1][2][3][size][4][5];
|
||||
|
@ -90,7 +90,7 @@ void VLAPtrAssign(int size) {
|
|||
int (*p4)[2][size][3][4][5] = array;
|
||||
}
|
||||
|
||||
void pr44406() {
|
||||
void pr44406(void) {
|
||||
goto L; // expected-error {{cannot jump}}
|
||||
int z[(int)(1.0 * 2)]; // expected-note {{bypasses initialization of variable length array}}
|
||||
L:;
|
||||
|
@ -101,7 +101,7 @@ typedef struct {
|
|||
char c[pr44406_a]; // expected-warning {{folded to constant array as an extension}}
|
||||
} pr44406_s;
|
||||
|
||||
void test_fold_to_constant_array() {
|
||||
void test_fold_to_constant_array(void) {
|
||||
const int ksize = 4;
|
||||
|
||||
goto jump_over_a1; // expected-error{{cannot jump from this goto statement to its label}}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
typedef void Void;
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
int X;
|
||||
|
||||
X = sizeof(int (void a)); // expected-error {{argument may not have 'void' type}}
|
||||
|
|
|
@ -780,11 +780,11 @@ void test_unsigned_long(unsigned long x) {
|
|||
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
|
||||
}
|
||||
|
||||
long long test_array() {
|
||||
long long test_array(void) {
|
||||
return llabs((long long[]){1});
|
||||
// expected-warning@-1 {{absolute value of array type}}
|
||||
}
|
||||
long long test_function_pointer() {
|
||||
long long test_function_pointer(void) {
|
||||
return llabs(&test_function_pointer);
|
||||
// expected-warning@-1 {{absolute value of pointer type}}
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ long long test_void_pointer(void *x) {
|
|||
return llabs(x);
|
||||
// expected-warning@-1 {{absolute value of pointer type}}
|
||||
}
|
||||
long long test_function() {
|
||||
long long test_function(void) {
|
||||
return llabs(test_function);
|
||||
// expected-warning@-1 {{absolute value of function type}}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
|
||||
int main() {
|
||||
int main(void) {
|
||||
int a;
|
||||
int b;
|
||||
a ? : b; //expected-warning{{expression result unused}}
|
||||
|
|
|
@ -53,7 +53,7 @@ struct S {
|
|||
struct S0 __attribute__((aligned(4))) s0;
|
||||
};
|
||||
|
||||
void test4() {
|
||||
void test4(void) {
|
||||
struct S s;
|
||||
int *i = (int *)s.a;
|
||||
i = (int *)&s.s0;
|
||||
|
@ -68,7 +68,7 @@ FnTy test5(void) {
|
|||
return (FnTy)&func5;
|
||||
}
|
||||
|
||||
void test6() {
|
||||
void test6(void) {
|
||||
struct {
|
||||
int hello;
|
||||
doesnotexist world; // expected-error {{unknown type name 'doesnotexist'}}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
const char *const ptr = 0;
|
||||
const char *const *ptrptr = 0;
|
||||
char *const *ptrcptr = 0;
|
||||
|
@ -38,7 +38,7 @@ void foo() {
|
|||
const char *charptr2 = (char *)charptr; // no warning
|
||||
}
|
||||
|
||||
void bar_0() {
|
||||
void bar_0(void) {
|
||||
struct C {
|
||||
const int a;
|
||||
int b;
|
||||
|
@ -50,7 +50,7 @@ void bar_0() {
|
|||
*(int *)(&S.b) = 0; // expected-warning {{cast from 'const int *' to 'int *' drops const qualifier}}
|
||||
}
|
||||
|
||||
void bar_1() {
|
||||
void bar_1(void) {
|
||||
struct C {
|
||||
const int a;
|
||||
int b;
|
||||
|
|
|
@ -1,63 +1,63 @@
|
|||
// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s
|
||||
|
||||
void t1() {
|
||||
void t1(void) {
|
||||
int array[1] = { 0 };
|
||||
char subscript = 0;
|
||||
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
void t2() {
|
||||
void t2(void) {
|
||||
int array[1] = { 0 };
|
||||
char subscript = 0;
|
||||
int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
void t3() {
|
||||
void t3(void) {
|
||||
int *array = 0;
|
||||
char subscript = 0;
|
||||
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
void t4() {
|
||||
void t4(void) {
|
||||
int *array = 0;
|
||||
char subscript = 0;
|
||||
int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
char returnsChar();
|
||||
void t5() {
|
||||
char returnsChar(void);
|
||||
void t5(void) {
|
||||
int *array = 0;
|
||||
int val = array[returnsChar()]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
void t6() {
|
||||
void t6(void) {
|
||||
int array[1] = { 0 };
|
||||
signed char subscript = 0;
|
||||
int val = array[subscript]; // no warning for explicit signed char
|
||||
}
|
||||
|
||||
void t7() {
|
||||
void t7(void) {
|
||||
int array[1] = { 0 };
|
||||
unsigned char subscript = 0;
|
||||
int val = array[subscript]; // no warning for unsigned char
|
||||
}
|
||||
|
||||
typedef char CharTy;
|
||||
void t8() {
|
||||
void t8(void) {
|
||||
int array[1] = { 0 };
|
||||
CharTy subscript = 0;
|
||||
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
|
||||
}
|
||||
|
||||
typedef signed char SignedCharTy;
|
||||
void t9() {
|
||||
void t9(void) {
|
||||
int array[1] = { 0 };
|
||||
SignedCharTy subscript = 0;
|
||||
int val = array[subscript]; // no warning for explicit signed char
|
||||
}
|
||||
|
||||
typedef unsigned char UnsignedCharTy;
|
||||
void t10() {
|
||||
void t10(void) {
|
||||
int array[1] = { 0 };
|
||||
UnsignedCharTy subscript = 0;
|
||||
int val = array[subscript]; // no warning for unsigned char
|
||||
|
|
|
@ -4,7 +4,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_1();
|
||||
void test_deprecated_1(void);
|
||||
|
||||
// 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
|
||||
|
|
|
@ -176,7 +176,7 @@ struct S;
|
|||
|
||||
// expected-warning@+1 {{unknown command tag name}}
|
||||
/// \t bbb IS_DOXYGEN_END
|
||||
int FooBar();
|
||||
int FooBar(void);
|
||||
|
||||
// rdar://13836387
|
||||
/** \brief Module handling the incoming notifications from the system.
|
||||
|
@ -256,7 +256,7 @@ struct HasFields {
|
|||
* \param p not here.
|
||||
* \returns integer.
|
||||
*/
|
||||
void (^_Nullable blockPointerVariableThatLeadsNowhere)();
|
||||
void (^_Nullable blockPointerVariableThatLeadsNowhere)(void);
|
||||
|
||||
@interface CheckFunctionBlockPointerVars {
|
||||
/**
|
||||
|
@ -298,7 +298,7 @@ void (^_Nullable blockPointerVariableThatLeadsNowhere)();
|
|||
* \returns Nothing, but can allow this as this pattern is used to document the
|
||||
* value that the property getter returns.
|
||||
*/
|
||||
@property void (^blockReturnsNothing)();
|
||||
@property void (^blockReturnsNothing)(void);
|
||||
|
||||
@end
|
||||
|
||||
|
@ -314,8 +314,8 @@ void (^_Nullable blockPointerVariableThatLeadsNowhere)();
|
|||
typedef void (^VariadicBlockType)(int a, ...);
|
||||
|
||||
// PR42844 - Assertion failures when using typedefed block pointers
|
||||
typedef void(^VoidBlockType)();
|
||||
typedef VoidBlockType VoidBlockTypeCall();
|
||||
typedef void(^VoidBlockType)(void);
|
||||
typedef VoidBlockType VoidBlockTypeCall(void);
|
||||
VoidBlockTypeCall *d; ///< \return none
|
||||
// expected-warning@-1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
|
||||
VoidBlockTypeCall ^e; ///< \return none
|
||||
|
|
|
@ -16,18 +16,18 @@ extern int main; // expected-warning{{variable named 'main' with external linkag
|
|||
|
||||
#elif TEST3
|
||||
// expected-no-diagnostics
|
||||
void x() {
|
||||
void x(void) {
|
||||
static int main;
|
||||
}
|
||||
|
||||
#elif TEST4
|
||||
void x() {
|
||||
void x(void) {
|
||||
extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}}
|
||||
}
|
||||
|
||||
#elif TEST5
|
||||
// expected-no-diagnostics
|
||||
void x() {
|
||||
void x(void) {
|
||||
int main;
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,13 @@ static int main;
|
|||
|
||||
#elif TEST7
|
||||
// expected-no-diagnostics
|
||||
void x() {
|
||||
void x(void) {
|
||||
auto int main;
|
||||
}
|
||||
|
||||
#elif TEST8
|
||||
// expected-no-diagnostics
|
||||
void x() {
|
||||
void x(void) {
|
||||
register int main;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ extern int scanf(const char *format, ...);
|
|||
extern int fscanf(FILE *f, const char *format, ...);
|
||||
extern int sscanf(const char *input, const char *format, ...);
|
||||
|
||||
void call_scanf() {
|
||||
void call_scanf(void) {
|
||||
char buf10[10];
|
||||
char buf20[20];
|
||||
char buf30[30];
|
||||
|
@ -41,7 +41,7 @@ void call_scanf() {
|
|||
scanf("%12d", &x);
|
||||
}
|
||||
|
||||
void call_sscanf() {
|
||||
void call_sscanf(void) {
|
||||
char buf10[10];
|
||||
char buf20[20];
|
||||
char buf30[30];
|
||||
|
@ -54,7 +54,7 @@ void call_sscanf() {
|
|||
sscanf("a b c", "%19s %29s %9s", buf20, buf30, buf10);
|
||||
}
|
||||
|
||||
void call_fscanf() {
|
||||
void call_fscanf(void) {
|
||||
char buf10[10];
|
||||
char buf20[20];
|
||||
char buf30[30];
|
||||
|
|
|
@ -21,7 +21,7 @@ void *memcpy(void *dst, const void *src, size_t c);
|
|||
}
|
||||
#endif
|
||||
|
||||
void call_memcpy() {
|
||||
void call_memcpy(void) {
|
||||
char dst[10];
|
||||
char src[20];
|
||||
memcpy(dst, src, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 10, but size argument is 20}}
|
||||
|
@ -30,7 +30,7 @@ void call_memcpy() {
|
|||
memcpy(dst, src, 20); // no warning, unreachable
|
||||
}
|
||||
|
||||
void call_memcpy_type() {
|
||||
void call_memcpy_type(void) {
|
||||
struct pair {
|
||||
int first;
|
||||
int second;
|
||||
|
@ -40,56 +40,56 @@ void call_memcpy_type() {
|
|||
memcpy(&p.first, buf, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 8, but size argument is 20}}
|
||||
}
|
||||
|
||||
void call_strncat() {
|
||||
void call_strncat(void) {
|
||||
char s1[10], s2[20];
|
||||
__builtin_strncat(s2, s1, 20);
|
||||
__builtin_strncat(s1, s2, 20); // expected-warning {{'strncat' size argument is too large; destination buffer has size 10, but size argument is 20}}
|
||||
}
|
||||
|
||||
void call_strncpy() {
|
||||
void call_strncpy(void) {
|
||||
char s1[10], s2[20];
|
||||
__builtin_strncpy(s2, s1, 20);
|
||||
__builtin_strncpy(s1, s2, 20); // expected-warning {{'strncpy' size argument is too large; destination buffer has size 10, but size argument is 20}}
|
||||
}
|
||||
|
||||
void call_stpncpy() {
|
||||
void call_stpncpy(void) {
|
||||
char s1[10], s2[20];
|
||||
__builtin_stpncpy(s2, s1, 20);
|
||||
__builtin_stpncpy(s1, s2, 20); // expected-warning {{'stpncpy' size argument is too large; destination buffer has size 10, but size argument is 20}}
|
||||
}
|
||||
|
||||
void call_strcpy() {
|
||||
void call_strcpy(void) {
|
||||
const char *const src = "abcd";
|
||||
char dst[4];
|
||||
__builtin_strcpy(dst, src); // expected-warning {{'strcpy' will always overflow; destination buffer has size 4, but the source string has length 5 (including NUL byte)}}
|
||||
}
|
||||
|
||||
void call_strcpy_nowarn() {
|
||||
void call_strcpy_nowarn(void) {
|
||||
const char *const src = "abcd";
|
||||
char dst[5];
|
||||
// We should not get a warning here.
|
||||
__builtin_strcpy(dst, src);
|
||||
}
|
||||
|
||||
void call_memmove() {
|
||||
void call_memmove(void) {
|
||||
char s1[10], s2[20];
|
||||
__builtin_memmove(s2, s1, 20);
|
||||
__builtin_memmove(s1, s2, 20); // expected-warning {{'memmove' will always overflow; destination buffer has size 10, but size argument is 20}}
|
||||
}
|
||||
|
||||
void call_memset() {
|
||||
void call_memset(void) {
|
||||
char buf[10];
|
||||
__builtin_memset(buf, 0xff, 10);
|
||||
__builtin_memset(buf, 0xff, 11); // expected-warning {{'memset' will always overflow; destination buffer has size 10, but size argument is 11}}
|
||||
}
|
||||
|
||||
void call_snprintf() {
|
||||
void call_snprintf(void) {
|
||||
char buf[10];
|
||||
__builtin_snprintf(buf, 10, "merp");
|
||||
__builtin_snprintf(buf, 11, "merp"); // expected-warning {{'snprintf' size argument is too large; destination buffer has size 10, but size argument is 11}}
|
||||
}
|
||||
|
||||
void call_vsnprintf() {
|
||||
void call_vsnprintf(void) {
|
||||
char buf[10];
|
||||
__builtin_va_list list;
|
||||
__builtin_vsnprintf(buf, 10, "merp", list);
|
||||
|
@ -148,7 +148,7 @@ void call_sprintf_chk(char *buf) {
|
|||
__builtin___sprintf_chk(buf, 1, 11, "%e", 9.f); // expected-warning {{'sprintf' will always overflow; destination buffer has size 11, but format string expands to at least 12}}
|
||||
}
|
||||
|
||||
void call_sprintf() {
|
||||
void call_sprintf(void) {
|
||||
char buf[6];
|
||||
sprintf(buf, "hell\0 boy"); // expected-warning {{format string contains '\0' within the string body}}
|
||||
sprintf(buf, "hello b\0y"); // expected-warning {{format string contains '\0' within the string body}}
|
||||
|
|
|
@ -10,7 +10,7 @@ struct S {
|
|||
};
|
||||
|
||||
int GI;
|
||||
void test() {
|
||||
void test(void) {
|
||||
{
|
||||
free(&GI); // expected-warning {{attempt to call free on non-heap object 'GI'}}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
|
||||
|
||||
int getInt();
|
||||
int getInt(void);
|
||||
|
||||
int test1(int i1, int i2) {
|
||||
int ret;
|
||||
|
@ -110,7 +110,7 @@ int test1(int i1, int i2) {
|
|||
}
|
||||
|
||||
enum E {e1, e2};
|
||||
enum E getE();
|
||||
enum E getE(void);
|
||||
|
||||
int test2 (enum E e) {
|
||||
int ret;
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
|
||||
|
||||
// expected-note@+1 5{{previous definition is here}}
|
||||
int main() {
|
||||
int main(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// expected-error@+3 {{conflicting types for 'main}}
|
||||
// expected-warning@+2 {{return type of 'main' is not 'int'}}
|
||||
// expected-note@+1 {{change return type to 'int'}}
|
||||
void main() {
|
||||
void main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int"
|
||||
}
|
||||
|
||||
// expected-error@+3 {{conflicting types for 'main}}
|
||||
// expected-warning@+2 {{return type of 'main' is not 'int'}}
|
||||
// expected-note@+1 {{change return type to 'int'}}
|
||||
double main() {
|
||||
double main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:7}:"int"
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ double main() {
|
|||
// expected-error@+3 {{conflicting types for 'main}}
|
||||
// expected-warning@+2 {{return type of 'main' is not 'int'}}
|
||||
// expected-note@+1 {{change return type to 'int'}}
|
||||
const float main() {
|
||||
const float main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:12}:"int"
|
||||
return 0.0f;
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ typedef void *(*fptr)(int a);
|
|||
// expected-error@+3 {{conflicting types for 'main}}
|
||||
// expected-warning@+2 {{return type of 'main' is not 'int'}}
|
||||
// expected-note@+1 {{change return type to 'int'}}
|
||||
fptr main() {
|
||||
fptr main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int"
|
||||
return (fptr) 0;
|
||||
}
|
||||
|
||||
// expected-error@+2 {{conflicting types for 'main}}
|
||||
// expected-warning@+1 {{return type of 'main' is not 'int'}}
|
||||
void *(*main())(int a) {
|
||||
void *(*main(void))(int a) {
|
||||
return (fptr) 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
|
||||
|
||||
// expected-note@+1 2{{previous definition is here}}
|
||||
int main() {
|
||||
int main(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// expected-error@+2 {{static declaration of 'main' follows non-static declaration}}
|
||||
// expected-warning@+1 {{'main' should not be declared static}}
|
||||
static int main() {
|
||||
static int main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
|
||||
return 0;
|
||||
}
|
||||
|
||||
// expected-error@+2 {{redefinition of 'main'}}
|
||||
// expected-error@+1 {{'main' is not allowed to be declared inline}}
|
||||
inline int main() {
|
||||
inline int main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ inline int main() {
|
|||
// expected-warning@+5 {{function 'main' declared 'noreturn' should not return}}
|
||||
// expected-warning@+2 {{'main' is not allowed to be declared _Noreturn}}
|
||||
// expected-note@+1 {{remove '_Noreturn'}}
|
||||
_Noreturn int main() {
|
||||
_Noreturn int main(void) {
|
||||
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:11}:""
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
int *p = 0;
|
||||
int *q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
int *r = (1 - 1); // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
void f() {
|
||||
void f(void) {
|
||||
p = 0;
|
||||
q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
r = 1 - 1; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
|
||||
|
|
|
@ -17,7 +17,7 @@ static const CCTestEnum SilenceWithCast2 = (CCTestEnum) 51; // no-warning
|
|||
static const CCTestEnum SilenceWithCast3 = (const CCTestEnum) 51; // no-warning
|
||||
static const CCTestEnum SilenceWithCast4 = (const volatile CCTestEnum) 51; // no-warning
|
||||
|
||||
void SilenceWithCastLocalVar() {
|
||||
void SilenceWithCastLocalVar(void) {
|
||||
CCTestEnum SilenceWithCast1 = 51; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
|
||||
CCTestEnum SilenceWithCast2 = (CCTestEnum) 51; // no-warning
|
||||
CCTestEnum SilenceWithCast3 = (const CCTestEnum) 51; // no-warning
|
||||
|
@ -45,13 +45,13 @@ typedef enum
|
|||
a = 0
|
||||
} T;
|
||||
|
||||
void f()
|
||||
void f(void)
|
||||
{
|
||||
T x = a;
|
||||
x += 1; // expected-warning {{integer constant not in range of enumerated type}}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
CCTestEnum test = 1; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
|
||||
test = 600; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
|
||||
foo(2); // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
|
||||
|
|
|
@ -92,7 +92,7 @@ void enums(enum Choices c) {
|
|||
}
|
||||
|
||||
// Don't generate a warning here.
|
||||
void array_out_of_bounds() {
|
||||
void array_out_of_bounds(void) {
|
||||
int x;
|
||||
int buffer[4];
|
||||
x = (-7 > 0) ? (buffer[-7]) : 0;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Test that using two macros from emmintrin do not cause a
|
||||
// useless -Wshadow warning.
|
||||
void rdar10679282() {
|
||||
void rdar10679282(void) {
|
||||
__m128i qf = _mm_setzero_si128();
|
||||
qf = _mm_slli_si128(_mm_add_epi64(qf, _mm_srli_si128(qf, 8)), 8); // no-warning
|
||||
(void) qf;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
int i; // expected-note 3 {{previous declaration is here}}
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
int pass1;
|
||||
int i; // expected-warning {{declaration shadows a variable in the global scope}} \
|
||||
// expected-note {{previous declaration is here}}
|
||||
|
@ -52,11 +52,11 @@ void test7(void *context, void (*callback)(void *context)) {}
|
|||
extern int bob; // expected-note {{previous declaration is here}}
|
||||
|
||||
// rdar://8883302
|
||||
void rdar8883302() {
|
||||
void rdar8883302(void) {
|
||||
extern int bob; // don't warn for shadowing.
|
||||
}
|
||||
|
||||
void test8() {
|
||||
void test8(void) {
|
||||
int bob; // expected-warning {{declaration shadows a variable in the global scope}}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -verify -fsyntax-only -Wstring-conversion %s
|
||||
|
||||
void do_nothing();
|
||||
void assert_error();
|
||||
void do_nothing(void);
|
||||
void assert_error(void);
|
||||
|
||||
#define assert1(expr) \
|
||||
if (expr) \
|
||||
|
@ -13,7 +13,7 @@ void assert_error();
|
|||
((expr) ? do_nothing() : assert_error())
|
||||
|
||||
// Exception for common assert form.
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
assert1(0 && "foo");
|
||||
assert1("foo" && 0);
|
||||
assert1(0 || "foo"); // expected-warning {{string literal}}
|
||||
|
@ -25,7 +25,7 @@ void test1() {
|
|||
assert2("foo"); // expected-warning {{string literal}}
|
||||
}
|
||||
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
if ("hi") {} // expected-warning {{string literal}}
|
||||
while ("hello") {} // expected-warning {{string literal}}
|
||||
for (;"howdy";) {} // expected-warning {{string literal}}
|
||||
|
|
|
@ -39,7 +39,7 @@ void flexible_arrays(struct S *s) {
|
|||
}
|
||||
|
||||
// Don't issue FIXIT for destinations of size 1.
|
||||
void size_1() {
|
||||
void size_1(void) {
|
||||
char z[1];
|
||||
char str[] = "hi";
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void flexible_arrays(struct S *s) {
|
|||
}
|
||||
|
||||
// Don't issue FIXIT for destinations of size 1.
|
||||
void size_1() {
|
||||
void size_1(void) {
|
||||
char z[1];
|
||||
char str[] = "hi";
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ struct {
|
|||
} c;
|
||||
const char str[] = "text";
|
||||
|
||||
void ignore() {
|
||||
void ignore(void) {
|
||||
if (!a) {}
|
||||
}
|
||||
void test() {
|
||||
void test(void) {
|
||||
if (!b) {} // expected-warning {{address of array 'b' will always evaluate to 'true'}}
|
||||
if (b == 0) {} // expected-warning {{comparison of array 'b' equal to a null pointer is always false}}
|
||||
if (!c.x) {} // expected-warning {{address of array 'c.x' will always evaluate to 'true'}}
|
||||
|
@ -21,7 +21,7 @@ void test() {
|
|||
}
|
||||
|
||||
int array[2];
|
||||
int test1()
|
||||
int test1(void)
|
||||
{
|
||||
if (!array) { // expected-warning {{address of array 'array' will always evaluate to 'true'}}
|
||||
return array[0];
|
||||
|
@ -51,7 +51,7 @@ int test2(int* pointer, char ch, void * pv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
if (array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}}
|
||||
if (array != 0) {} // expected-warning {{comparison of array 'array' not equal to a null pointer is always true}}
|
||||
if (!array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}}
|
||||
|
@ -85,7 +85,7 @@ void _HTTPClientErrorHandler(int me)
|
|||
SAVE_READ(&me);
|
||||
}
|
||||
|
||||
void test_conditional_operator() {
|
||||
void test_conditional_operator(void) {
|
||||
int x;
|
||||
x = b ? 1 : 0; // expected-warning {{address of array}}
|
||||
x = c.x ? 1 : 0; // expected-warning {{address of array}}
|
||||
|
|
|
@ -72,7 +72,7 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
|
|||
return *p;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
|
||||
Foo_fun1(1); // expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu2'}} \
|
||||
expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu1' exclusively}}
|
||||
|
@ -132,4 +132,4 @@ int main() {
|
|||
|
||||
// We had a problem where we'd skip all attributes that follow a late-parsed
|
||||
// attribute in a single __attribute__.
|
||||
void run() __attribute__((guarded_by(mu1), guarded_by(mu1))); // expected-warning 2{{only applies to non-static data members and global variables}}
|
||||
void run(void) __attribute__((guarded_by(mu1), guarded_by(mu1))); // expected-warning 2{{only applies to non-static data members and global variables}}
|
||||
|
|
|
@ -86,7 +86,7 @@ void test_tag_mismatch(int *ptr)
|
|||
C_func(ptr, 20); // should warn, but may cause false positives
|
||||
}
|
||||
|
||||
void test_null_pointer()
|
||||
void test_null_pointer(void)
|
||||
{
|
||||
C_func(0, C_tag); // no-warning
|
||||
C_func((void *) 0, C_tag); // no-warning
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: %clang_cc1 %s -triple=i686-pc-win32 -fsyntax-only -verify -fms-extensions -Wunreachable-code
|
||||
|
||||
void f();
|
||||
void f(void);
|
||||
|
||||
void g1() {
|
||||
void g1(void) {
|
||||
__try {
|
||||
f();
|
||||
__leave;
|
||||
|
@ -24,7 +24,7 @@ void g1() {
|
|||
}
|
||||
}
|
||||
|
||||
void g2() {
|
||||
void g2(void) {
|
||||
__try {
|
||||
// Nested __try.
|
||||
__try {
|
||||
|
@ -41,7 +41,7 @@ void g2() {
|
|||
}
|
||||
}
|
||||
|
||||
void g3() {
|
||||
void g3(void) {
|
||||
__try {
|
||||
__try {
|
||||
f();
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include "warn-unreachable.h"
|
||||
|
||||
int halt() __attribute__((noreturn));
|
||||
int live();
|
||||
int dead();
|
||||
int halt(void) __attribute__((noreturn));
|
||||
int live(void);
|
||||
int dead(void);
|
||||
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
goto c;
|
||||
d:
|
||||
goto e; // expected-warning {{will never be executed}}
|
||||
|
@ -26,7 +26,7 @@ void test1() {
|
|||
f: ;
|
||||
}
|
||||
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
int i;
|
||||
switch (live()) {
|
||||
case 1:
|
||||
|
@ -123,7 +123,7 @@ void __myassert_rtn(const char *, const char *, int, const char *) __attribute__
|
|||
#define myassert(e) \
|
||||
(__builtin_expect(!(e), 0) ? __myassert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
|
||||
|
||||
void test_assert() {
|
||||
void test_assert(void) {
|
||||
myassert(0 && "unreachable");
|
||||
return; // no-warning
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ void PR9774(int *s) {
|
|||
|
||||
// Test case for <rdar://problem/11005770>. We should treat code guarded
|
||||
// by 'x & 0' and 'x * 0' as unreachable.
|
||||
int calledFun();
|
||||
int calledFun(void);
|
||||
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}}
|
||||
|
@ -145,8 +145,8 @@ void test_mul_and_zero(int x) {
|
|||
if (0 * x) calledFun(); // expected-warning {{will never be executed}}
|
||||
}
|
||||
|
||||
void raze() __attribute__((noreturn));
|
||||
void warn_here();
|
||||
void raze(void) __attribute__((noreturn));
|
||||
void warn_here(void);
|
||||
|
||||
int test_break_preceded_by_noreturn(int i) {
|
||||
switch (i) {
|
||||
|
@ -193,17 +193,17 @@ void unreachable_in_default(MyEnum e) {
|
|||
}
|
||||
|
||||
// Don't warn about trivial dead returns.
|
||||
int trivial_dead_return() {
|
||||
int trivial_dead_return(void) {
|
||||
raze();
|
||||
return ((0)); // expected-warning {{'return' will never be executed}}
|
||||
}
|
||||
|
||||
void trivial_dead_return_void() {
|
||||
void trivial_dead_return_void(void) {
|
||||
raze();
|
||||
return; // expected-warning {{'return' will never be executed}}
|
||||
}
|
||||
|
||||
MyEnum trivial_dead_return_enum() {
|
||||
MyEnum trivial_dead_return_enum(void) {
|
||||
raze();
|
||||
return Value1; // expected-warning {{'return' will never be executed}}
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ MyEnum trivial_dead_return_enum_2(int x) {
|
|||
return 2; // expected-warning {{will never be executed}}
|
||||
}
|
||||
|
||||
const char *trivial_dead_return_cstr() {
|
||||
const char *trivial_dead_return_cstr(void) {
|
||||
raze();
|
||||
return ""; // expected-warning {{return' will never be executed}}
|
||||
}
|
||||
|
||||
char trivial_dead_return_char() {
|
||||
char trivial_dead_return_char(void) {
|
||||
raze();
|
||||
return ' '; // expected-warning {{return' will never be executed}}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ enum MyEnum2 {
|
|||
ME_B = 1
|
||||
};
|
||||
|
||||
int test_MyEnum() {
|
||||
int test_MyEnum(void) {
|
||||
if (!ME_A)
|
||||
return 1; // no-warning
|
||||
if (ME_A)
|
||||
|
@ -329,12 +329,12 @@ int test_do_while_nontrivial_cond(int x) {
|
|||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunreachable-code-return"
|
||||
|
||||
void trivial_dead_return_void_SUPPRESSED() {
|
||||
void trivial_dead_return_void_SUPPRESSED(void) {
|
||||
raze();
|
||||
return; // no-warning
|
||||
}
|
||||
|
||||
MyEnum trivial_dead_return_enum_SUPPRESSED() {
|
||||
MyEnum trivial_dead_return_enum_SUPPRESSED(void) {
|
||||
raze();
|
||||
return Value1; // no-warning
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void wrapOneInFixit(struct StructWithPointer *s) {
|
|||
wrapOneInFixit(s); // expected-warning {{code will never be executed}}
|
||||
}
|
||||
|
||||
void unaryOpNoFixit() {
|
||||
void unaryOpNoFixit(void) {
|
||||
if (~ 1)
|
||||
return; // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
|
||||
unaryOpNoFixit(); // expected-warning {{code will never be executed}}
|
||||
|
@ -455,7 +455,7 @@ void unaryOpFixitCastSubExpr(int x) {
|
|||
#define false 0
|
||||
#define true 1
|
||||
|
||||
void testTrueFalseMacros() {
|
||||
void testTrueFalseMacros(void) {
|
||||
if (false) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
|
||||
testTrueFalseMacros(); // expected-warning {{code will never be executed}}
|
||||
if (!true) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
|
||||
|
@ -490,13 +490,13 @@ int pr13910_bar2(int x) {
|
|||
pr13910_foo(x); // expected-warning {{code will never be executed}}
|
||||
}
|
||||
|
||||
void pr13910_noreturn() {
|
||||
void pr13910_noreturn(void) {
|
||||
raze();
|
||||
__builtin_unreachable(); // expected no warning
|
||||
__builtin_assume(0); // expected no warning
|
||||
}
|
||||
|
||||
void pr13910_assert() {
|
||||
void pr13910_assert(void) {
|
||||
myassert(0 && "unreachable");
|
||||
return;
|
||||
__builtin_unreachable(); // expected no warning
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fobjc-exceptions -verify -Wunreachable-code %s
|
||||
|
||||
void f();
|
||||
void f(void);
|
||||
|
||||
void g1() {
|
||||
void g1(void) {
|
||||
@try {
|
||||
f();
|
||||
@throw @"";
|
||||
|
@ -24,7 +24,7 @@ void g1() {
|
|||
}
|
||||
}
|
||||
|
||||
void g2() {
|
||||
void g2(void) {
|
||||
@try {
|
||||
// Nested @try.
|
||||
@try {
|
||||
|
@ -41,7 +41,7 @@ void g2() {
|
|||
}
|
||||
}
|
||||
|
||||
void g3() {
|
||||
void g3(void) {
|
||||
@try {
|
||||
@try {
|
||||
f();
|
||||
|
|
|
@ -6,7 +6,7 @@ typedef struct A {
|
|||
int x, y;
|
||||
} A;
|
||||
|
||||
void test() {
|
||||
void test(void) {
|
||||
int a;
|
||||
int xs[10];
|
||||
a + ++a; // expected-warning {{unsequenced modification and access to 'a'}}
|
||||
|
|
|
@ -4,7 +4,7 @@ struct S {
|
|||
int i;
|
||||
};
|
||||
|
||||
int f0() {
|
||||
int f0(void) {
|
||||
int y; // expected-warning{{variable 'y' set but not used}}
|
||||
y = 0;
|
||||
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-infinite-recursion %s
|
||||
|
||||
void foo() {}
|
||||
static void f2() {}
|
||||
static void f1() {f2();} // expected-warning{{unused}}
|
||||
void foo(void) {}
|
||||
static void f2(void) {}
|
||||
static void f1(void) {f2();} // expected-warning{{unused}}
|
||||
|
||||
static int f0() { return 17; } // expected-warning{{not needed and will not be emitted}}
|
||||
static int f0(void) { return 17; } // expected-warning{{not needed and will not be emitted}}
|
||||
int x = sizeof(f0());
|
||||
|
||||
static void f3();
|
||||
extern void f3() { } // expected-warning{{unused}}
|
||||
static void f3(void);
|
||||
extern void f3(void) { } // expected-warning{{unused}}
|
||||
|
||||
inline static void f4();
|
||||
void f4() { } // expected-warning{{unused}}
|
||||
inline static void f4(void);
|
||||
void f4(void) { } // expected-warning{{unused}}
|
||||
|
||||
static void __attribute__((used)) f5() {}
|
||||
static void f6();
|
||||
static void __attribute__((used)) f6();
|
||||
static void f6() {};
|
||||
static void __attribute__((used)) f5(void) {}
|
||||
static void f6(void);
|
||||
static void __attribute__((used)) f6(void);
|
||||
static void f6(void) {};
|
||||
|
||||
static void f7(void);
|
||||
void f8(void(*a0)(void));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wunused-label -verify %s
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
a:
|
||||
goto a;
|
||||
b: // expected-warning{{unused}}
|
||||
|
@ -10,6 +10,6 @@ void f() {
|
|||
return;
|
||||
}
|
||||
|
||||
void PR8455() {
|
||||
void PR8455(void) {
|
||||
L: __attribute__((unused)) return; // ok, no semicolon required
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ void f1(void) {
|
|||
|
||||
// Used when testing '-Wunused' to see that we only emit one diagnostic, and no
|
||||
// warnings for the above cases.
|
||||
static void achor() {};
|
||||
static void achor(void) {};
|
||||
|
||||
// Do not warn on naked functions.
|
||||
__attribute__((naked)) static void nakedFunction(int a, int b) { }
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
int i = 0;
|
||||
int j = 0;
|
||||
|
||||
void foo();
|
||||
void foo(void);
|
||||
|
||||
// PR4806
|
||||
void pr4806() {
|
||||
void pr4806(void) {
|
||||
1,foo(); // expected-warning {{left operand of comma operator has no effect}}
|
||||
|
||||
// other
|
||||
|
@ -58,10 +58,10 @@ void pr4806() {
|
|||
}
|
||||
|
||||
// Don't warn about unused '||', '&&' expressions that contain assignments.
|
||||
int test_logical_foo1();
|
||||
int test_logical_foo2();
|
||||
int test_logical_foo3();
|
||||
int test_logical_bar() {
|
||||
int test_logical_foo1(void);
|
||||
int test_logical_foo2(void);
|
||||
int test_logical_foo3(void);
|
||||
int test_logical_bar(void) {
|
||||
int x = 0;
|
||||
(x = test_logical_foo1()) || // no-warning
|
||||
(x = test_logical_foo2()) || // no-warning
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Werror -verify %s
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
int i; // expected-error{{unused}}
|
||||
int j; // expected-error{{unused}}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ void f1(void) {
|
|||
}
|
||||
|
||||
// PR5933
|
||||
int f2() {
|
||||
int f2(void) {
|
||||
int X = 4; // Shouldn't have a bogus 'unused variable X' warning.
|
||||
return Y + X; // expected-error {{use of undeclared identifier 'Y'}}
|
||||
}
|
||||
|
||||
int f3() {
|
||||
int f3(void) {
|
||||
int X1 = 4;
|
||||
(void)(Y1 + X1); // expected-error {{use of undeclared identifier 'Y1'}}
|
||||
(void)(^() { int X = 4; }); // expected-warning{{unused}}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// expected-no-diagnostics
|
||||
|
||||
static int a;
|
||||
int bar() {
|
||||
int bar(void) {
|
||||
extern int a;
|
||||
return a;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef __WCHAR_TYPE__ wchar_t;
|
|||
|
||||
int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
|
||||
|
||||
void foo() {
|
||||
void foo(void) {
|
||||
WCHAR_T_TYPE t1[] = L"x";
|
||||
wchar_t tab[] = L"x";
|
||||
WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}}
|
||||
|
|
|
@ -14,8 +14,8 @@ void d(void);
|
|||
void __attribute__((force_align_arg_pointer)) d(void) {}
|
||||
|
||||
// Attribute is ignored on function pointer types.
|
||||
void (__attribute__((force_align_arg_pointer)) *p)();
|
||||
typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
|
||||
void (__attribute__((force_align_arg_pointer)) *p)(void);
|
||||
typedef void (__attribute__((__force_align_arg_pointer__)) *p2)(void);
|
||||
// Attribute is also ignored on function typedefs.
|
||||
typedef void __attribute__((force_align_arg_pointer)) e(void);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
|
||||
void foo() __attribute__((xray_always_instrument));
|
||||
void foo(void) __attribute__((xray_always_instrument));
|
||||
|
||||
struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and Objective-C methods}}
|
||||
|
||||
void bar() __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
|
||||
void bar(void) __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
void foo(int) __attribute__((xray_log_args(1)));
|
||||
struct __attribute__((xray_log_args(1))) a { int x; }; // expected-warning {{'xray_log_args' attribute only applies to functions and Objective-C methods}}
|
||||
|
||||
void fop() __attribute__((xray_log_args(1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
void fop(void) __attribute__((xray_log_args(1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
|
||||
void foq() __attribute__((xray_log_args(-1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
void foq(void) __attribute__((xray_log_args(-1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
|
||||
void fos() __attribute__((xray_log_args(0))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
void fos(void) __attribute__((xray_log_args(0))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
// expected-warning@+14 {{'__device_builtin_texture_type__' attribute only applies to classes}}
|
||||
#endif
|
||||
|
||||
__declspec(__device__) void f_device();
|
||||
__declspec(__global__) void f_global();
|
||||
__declspec(__device__) void f_device(void);
|
||||
__declspec(__global__) void f_global(void);
|
||||
__declspec(__constant__) int* g_constant;
|
||||
__declspec(__shared__) float *g_shared;
|
||||
__declspec(__host__) void f_host();
|
||||
__declspec(__device_builtin__) void f_device_builtin();
|
||||
__declspec(__host__) void f_host(void);
|
||||
__declspec(__device_builtin__) void f_device_builtin(void);
|
||||
typedef __declspec(__device_builtin__) const void *t_device_builtin;
|
||||
enum __declspec(__device_builtin__) e_device_builtin {E};
|
||||
__declspec(__device_builtin__) int v_device_builtin;
|
||||
__declspec(__cudart_builtin__) void f_cudart_builtin();
|
||||
__declspec(__cudart_builtin__) void f_cudart_builtin(void);
|
||||
__declspec(__device_builtin_surface_type__) unsigned long long surface_var;
|
||||
__declspec(__device_builtin_texture_type__) unsigned long long texture_var;
|
||||
|
||||
|
|
|
@ -22,16 +22,16 @@
|
|||
// expected-warning@+15 {{'device_builtin_texture_type' attribute only applies to classes}}
|
||||
#endif
|
||||
|
||||
__attribute__((device)) void f_device();
|
||||
__attribute__((global)) void f_global();
|
||||
__attribute__((device)) void f_device(void);
|
||||
__attribute__((global)) void f_global(void);
|
||||
__attribute__((constant)) int* g_constant;
|
||||
__attribute__((shared)) float *g_shared;
|
||||
__attribute__((host)) void f_host();
|
||||
__attribute__((device_builtin)) void f_device_builtin();
|
||||
__attribute__((host)) void f_host(void);
|
||||
__attribute__((device_builtin)) void f_device_builtin(void);
|
||||
typedef __attribute__((device_builtin)) const void *t_device_builtin;
|
||||
enum __attribute__((device_builtin)) e_device_builtin {E};
|
||||
__attribute__((device_builtin)) int v_device_builtin;
|
||||
__attribute__((cudart_builtin)) void f_cudart_builtin();
|
||||
__attribute__((nv_weak)) void f_nv_weak();
|
||||
__attribute__((cudart_builtin)) void f_cudart_builtin(void);
|
||||
__attribute__((nv_weak)) void f_nv_weak(void);
|
||||
__attribute__((device_builtin_surface_type)) unsigned long long surface_var;
|
||||
__attribute__((device_builtin_texture_type)) unsigned long long texture_var;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only %s
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
|
||||
// RUN: cp %s %t
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t
|
||||
// RUN: cp %s %t.cpp
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t.cpp
|
||||
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t.cpp
|
||||
|
||||
#if !__has_feature(attribute_deprecated_with_replacement)
|
||||
#error "Missing __has_feature"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#define ATTR __attribute__((require_constant_initialization)) // expected-note 0+ {{expanded from macro}}
|
||||
|
||||
int ReturnInt(); // expected-note 0+ {{declared here}}
|
||||
int ReturnInt(void); // expected-note 0+ {{declared here}}
|
||||
|
||||
struct PODType { // expected-note 0+ {{declared here}}
|
||||
int value; // expected-note 0-2 {{declared here}}
|
||||
|
@ -78,7 +78,7 @@ ATTR const int &glvalue_ref ATTR = glvalue_int;
|
|||
ATTR const int &glvalue_ref2 ATTR = glvalue_int2;
|
||||
ATTR __thread const int &glvalue_ref_tl = glvalue_int;
|
||||
|
||||
void test_basic_start_static_2_1() {
|
||||
void test_basic_start_static_2_1(void) {
|
||||
const int non_global = 42;
|
||||
ATTR static const int &local_init = non_global; // expected-error {{variable does not have a constant initializer}}
|
||||
// expected-note@-1 {{required by 'require_constant_initialization' attribute here}}
|
||||
|
@ -146,7 +146,7 @@ thread_local const int &TT1::tl_temp_init = 42; // expected-error {{variable doe
|
|||
// constructor call, and if the initialization full-expression is a constant
|
||||
// initializer for the object;
|
||||
|
||||
void test_basic_start_static_2_2() {
|
||||
void test_basic_start_static_2_2(void) {
|
||||
#if __cplusplus < 201103L
|
||||
ATTR static PODType pod;
|
||||
#else
|
||||
|
@ -249,7 +249,7 @@ ATTR int lit_in_init = LitType{42}.value;
|
|||
// if an object with static or thread storage duration is not initialized by a
|
||||
// constructor call and if either the object is value-initialized or every
|
||||
// full-expression that appears in its initializer is a constant expression.
|
||||
void test_basic_start_static_2_3() {
|
||||
void test_basic_start_static_2_3(void) {
|
||||
ATTR static int static_local = 42;
|
||||
ATTR static int static_local2; // zero-initialization takes place
|
||||
#if __cplusplus >= 201103L
|
||||
|
|
|
@ -15,7 +15,7 @@ struct is_same { static constexpr bool value = false; };
|
|||
template <typename T>
|
||||
struct is_same<T, T> { static constexpr bool value = true; };
|
||||
|
||||
void SSizeT() {
|
||||
void SSizeT(void) {
|
||||
auto a1 = 1z;
|
||||
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
|
||||
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
|
||||
|
@ -27,7 +27,7 @@ void SSizeT() {
|
|||
static_assert(is_same<decltype(a2), ssize_t>::value);
|
||||
}
|
||||
|
||||
void SizeT() {
|
||||
void SizeT(void) {
|
||||
auto a1 = 1uz;
|
||||
// cxx2b-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
|
||||
// cxx20-warning@-2 {{'size_t' suffix for literals is a C++2b extension}}
|
||||
|
@ -69,7 +69,7 @@ void SizeT() {
|
|||
static_assert(is_same<decltype(a8), size_t>::value);
|
||||
}
|
||||
|
||||
void oor() {
|
||||
void oor(void) {
|
||||
#if __i386__
|
||||
(void)3'000'000'000z; // cxx2b-32-error {{signed 'size_t' literal is out of range of possible signed 'size_t' values}}
|
||||
(void)3'000'000'000uz;
|
||||
|
@ -83,7 +83,7 @@ void oor() {
|
|||
|
||||
#else
|
||||
|
||||
void f() {
|
||||
void f(void) {
|
||||
(void)1z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
|
||||
(void)1Z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
|
||||
(void)1uz; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// Test that GNU C extension __builtin_types_compatible_p() is not available in C++ mode.
|
||||
|
||||
int f() {
|
||||
int f(void) {
|
||||
return __builtin_types_compatible_p(int, const int); // expected-error{{expected '(' for function-style cast or type construction}} \
|
||||
// expected-error{{expected expression}}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -Wcomma -x c -std=c17 -verify %s
|
||||
|
||||
// int returning function
|
||||
int return_four() { return 5; }
|
||||
int return_four(void) { return 5; }
|
||||
|
||||
// Test builtin operators
|
||||
void test_builtin() {
|
||||
void test_builtin(void) {
|
||||
int x = 0, y = 0;
|
||||
for (; y < 10; x++, y++) {}
|
||||
for (; y < 10; ++x, y++) {}
|
||||
|
@ -32,7 +32,7 @@ void test_builtin() {
|
|||
}
|
||||
|
||||
// Test nested comma operators
|
||||
void test_nested() {
|
||||
void test_nested(void) {
|
||||
int x1, x2, x3;
|
||||
int y1, *y2 = 0, y3 = 5;
|
||||
|
||||
|
@ -42,7 +42,7 @@ void test_nested() {
|
|||
}
|
||||
|
||||
// Confusing "," for "=="
|
||||
void test_compare() {
|
||||
void test_compare(void) {
|
||||
if (return_four(), 5) {}
|
||||
// expected-warning@-1{{comma operator}}
|
||||
// expected-note@-2{{cast expression to void}}
|
||||
|
@ -53,7 +53,7 @@ void test_compare() {
|
|||
}
|
||||
|
||||
// Confusing "," for "+"
|
||||
int test_plus() {
|
||||
int test_plus(void) {
|
||||
return return_four(), return_four();
|
||||
// expected-warning@-1{{comma operator}}
|
||||
// expected-note@-2{{cast expression to void}}
|
||||
|
@ -64,7 +64,7 @@ int test_plus() {
|
|||
}
|
||||
|
||||
// Be sure to look through parentheses
|
||||
void test_parentheses() {
|
||||
void test_parentheses(void) {
|
||||
int x, y;
|
||||
for (x = 0; return_four(), x;) {}
|
||||
// expected-warning@-1{{comma operator}}
|
||||
|
@ -79,7 +79,7 @@ void test_parentheses() {
|
|||
// CHECK: fix-it:{{.*}}:{[[@LINE-4]]:30-[[@LINE-4]]:30}:")"
|
||||
}
|
||||
|
||||
void test_increment() {
|
||||
void test_increment(void) {
|
||||
int x, y;
|
||||
++x, ++y;
|
||||
// expected-warning@-1{{comma operator}}
|
||||
|
@ -128,7 +128,7 @@ void test_conditions(int x) {
|
|||
}
|
||||
|
||||
// Nested comma operator with fix-its.
|
||||
void test_nested_fixits() {
|
||||
void test_nested_fixits(void) {
|
||||
return_four(), return_four(), return_four(), return_four();
|
||||
// expected-warning@-1 3{{comma operator}}
|
||||
// expected-note@-2 3{{cast expression to void}}
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef int alias2; // expected-note {{previous declaration is here}}
|
|||
alias *p;
|
||||
class2 *p2;
|
||||
|
||||
int foo ()
|
||||
int foo (void)
|
||||
{
|
||||
|
||||
if (p == p2) {
|
||||
|
|
|
@ -9,15 +9,15 @@ typedef const struct __CFString *CFStringRef;
|
|||
@interface NSString
|
||||
@end
|
||||
|
||||
CFTypeRef CFCreateSomething();
|
||||
CFStringRef CFCreateString();
|
||||
CFTypeRef CFGetSomething();
|
||||
CFStringRef CFGetString();
|
||||
CFTypeRef CFCreateSomething(void);
|
||||
CFStringRef CFCreateString(void);
|
||||
CFTypeRef CFGetSomething(void);
|
||||
CFStringRef CFGetString(void);
|
||||
|
||||
id CreateSomething();
|
||||
NSString *CreateNSString();
|
||||
id CreateSomething(void);
|
||||
NSString *CreateNSString(void);
|
||||
|
||||
void from_cf() {
|
||||
void from_cf(void) {
|
||||
id obj1 = (__bridge_transfer id)CFCreateSomething();
|
||||
id obj2 = (__bridge_transfer NSString*)CFCreateString();
|
||||
(__bridge int*)CFCreateSomething(); // expected-error{{incompatible types casting 'CFTypeRef' (aka 'const void *') to 'int *' with a __bridge cast}}
|
||||
|
@ -36,7 +36,7 @@ void to_cf(id obj) {
|
|||
// CHECK: fix-it:"{{.*}}":{35:20-35:35}:"__bridge_retained"
|
||||
}
|
||||
|
||||
CFTypeRef fixits() {
|
||||
CFTypeRef fixits(void) {
|
||||
id obj1 = (id)CFCreateSomething(); // expected-error{{cast of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast}} \
|
||||
// expected-note{{use __bridge to convert directly (no change in ownership)}} expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}}
|
||||
// CHECK: fix-it:"{{.*}}":{40:17-40:17}:"CFBridgingRelease("
|
||||
|
@ -65,9 +65,9 @@ CFTypeRef fixitsWithSpace(id obj) {
|
|||
|
||||
// rdar://problem/20107345
|
||||
typedef const struct __attribute__((objc_bridge(id))) __CFAnnotatedObject *CFAnnotatedObjectRef;
|
||||
CFAnnotatedObjectRef CFGetAnnotated();
|
||||
CFAnnotatedObjectRef CFGetAnnotated(void);
|
||||
|
||||
void testObjCBridgeId() {
|
||||
void testObjCBridgeId(void) {
|
||||
id obj;
|
||||
obj = (__bridge id)CFGetAnnotated();
|
||||
obj = (__bridge NSString*)CFGetAnnotated();
|
||||
|
|
|
@ -13,7 +13,7 @@ extern CFStringRef CFMakeString0(void);
|
|||
#pragma clang arc_cf_code_audited begin
|
||||
extern CFStringRef CFCreateString0(void);
|
||||
#pragma clang arc_cf_code_audited end
|
||||
void test0() {
|
||||
void test0(void) {
|
||||
id x;
|
||||
x = (id) CFMakeString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{CFBridgingRelease call to transfer}}
|
||||
x = (id) CFCreateString0(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
|
||||
|
@ -21,7 +21,7 @@ void test0() {
|
|||
|
||||
extern CFStringRef CFMakeString1(void) __attribute__((cf_returns_not_retained));
|
||||
extern CFStringRef CFCreateString1(void) __attribute__((cf_returns_retained));
|
||||
void test1() {
|
||||
void test1(void) {
|
||||
id x;
|
||||
x = (id) CFMakeString1();
|
||||
x = (id) CFCreateString1(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
|
||||
|
@ -38,7 +38,7 @@ extern CFStringRef CFCreateString2(void) CF_RETURNS_NOT_RETAINED;
|
|||
extern CFStringRef CFMakeString3(void) CF_RETURNS_RETAINED;
|
||||
extern CFStringRef CFCreateString3(void);
|
||||
CF_AUDIT_END
|
||||
void test2() {
|
||||
void test2(void) {
|
||||
id x;
|
||||
x = (id) CFMakeString2();
|
||||
x = (id) CFCreateString2();
|
||||
|
@ -53,7 +53,7 @@ typedef signed int SInt32;
|
|||
extern SInt32 CFStringGetIntValue(CFStringRef str); // expected-note {{passing argument to parameter 'str' here}}
|
||||
#pragma clang arc_cf_code_audited end
|
||||
|
||||
void test3() {
|
||||
void test3(void) {
|
||||
NSString* answer = @"42";
|
||||
int ans = CFStringGetIntValue(answer); // expected-error {{incompatible pointer types passing retainable parameter of type 'NSString *__strong'to a CF function expecting 'CFStringRef'}}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ union u_trivial_c {
|
|||
|
||||
// rdar://10260525
|
||||
struct r10260525 {
|
||||
id (^block) ();
|
||||
id (^block1) ();
|
||||
id (^block2) (void);
|
||||
};
|
||||
|
||||
struct S {
|
||||
|
@ -54,7 +55,7 @@ __autoreleasing NSError *E; // expected-error {{global variables cannot have __a
|
|||
|
||||
extern id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
|
||||
|
||||
void func()
|
||||
void func(void)
|
||||
{
|
||||
id X;
|
||||
static id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
|
||||
|
|
|
@ -26,7 +26,7 @@ id CFBridgingRelease(CFTypeRef __attribute__((cf_consumed)) X);
|
|||
|
||||
@interface NSMutableString @end
|
||||
|
||||
NSMutableString *test() {
|
||||
NSMutableString *test(void) {
|
||||
NSDictionary *infoDictionary;
|
||||
infoDictionary[kCFBundleNameKey] = 0; // expected-error {{indexing expression is invalid because subscript type 'CFStringRef' (aka 'const struct __CFString *') is not an integral or Objective-C pointer type}}
|
||||
return infoDictionary[CFStringCreateMutable(((void*)0), 100)]; // expected-error {{indexing expression is invalid because subscript type 'CFMutableStringRef' (aka 'struct __CFString *') is not an integral or Objective-C pointer type}} \
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
typedef const struct __CFString * CFStringRef;
|
||||
@class NSString;
|
||||
|
||||
NSString *CFBridgingRelease();
|
||||
NSString *CFBridgingRelease(void);
|
||||
|
||||
typedef NSString * PNSString;
|
||||
|
||||
|
@ -42,7 +42,7 @@ typedef __strong I *strong_I;
|
|||
__unsafe_unretained strong_I test5;
|
||||
|
||||
// rdar://10907090
|
||||
typedef void (^T) ();
|
||||
typedef void (^T) (void);
|
||||
@interface NSObject @end
|
||||
@protocol P;
|
||||
@interface Radar10907090 @end
|
||||
|
@ -54,7 +54,7 @@ typedef void (^T) ();
|
|||
- (void) M : (NSObject**)arg0 : (id*)arg {} // expected-warning {{method parameter of type 'NSObject *__autoreleasing *' with no explicit ownership}} \
|
||||
// expected-warning {{method parameter of type '__autoreleasing id *' with no explicit ownership}}
|
||||
- (void) N : (__strong NSObject***) arg0 : (__strong NSObject<P>***)arg : (float**) arg1 : (double) arg2 {}
|
||||
- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)()') with no explicit ownership}}
|
||||
- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning-re {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)({{(void)?}})') with no explicit ownership}}
|
||||
@end
|
||||
|
||||
// rdar://12280826
|
||||
|
@ -73,32 +73,32 @@ typedef NSObject *NSObject_ptr;
|
|||
typedef __strong NSObject *strong_NSObject_ptr;
|
||||
|
||||
// Warn
|
||||
__strong id f1(); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
__strong id f1(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
NSObject __unsafe_unretained *f2(int); // expected-warning{{ARC __unsafe_unretained lifetime qualifier on return type is ignored}}
|
||||
__autoreleasing NSObject *f3(void); // expected-warning{{ARC __autoreleasing lifetime qualifier on return type is ignored}}
|
||||
NSObject * __strong f4(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
NSObject_ptr __strong f5(); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
NSObject_ptr __strong f5(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
|
||||
typedef __strong id (*fptr)(int); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
|
||||
|
||||
// Don't warn
|
||||
strong_id f6();
|
||||
strong_NSObject_ptr f7();
|
||||
strong_id f6(void);
|
||||
strong_NSObject_ptr f7(void);
|
||||
typedef __strong id (^block_ptr)(int);
|
||||
|
||||
// rdar://10127067
|
||||
void test8_a() {
|
||||
void test8_a(void) {
|
||||
__weak id *(^myBlock)(void);
|
||||
__weak id *var = myBlock();
|
||||
(void) (__strong id *) &myBlock;
|
||||
(void) (__weak id *) &myBlock; // expected-error {{cast}}
|
||||
}
|
||||
void test8_b() {
|
||||
void test8_b(void) {
|
||||
__weak id (^myBlock)(void);
|
||||
(void) (__weak id *) &myBlock;
|
||||
(void) (__strong id *) &myBlock; // expected-error {{cast}}
|
||||
}
|
||||
void test8_c() {
|
||||
void test8_c(void) {
|
||||
__weak id (^*(^myBlock)(void))(void);
|
||||
(void) (__weak id*) myBlock();
|
||||
(void) (__strong id*) myBlock(); // expected-error {{cast}}
|
||||
|
@ -107,18 +107,18 @@ void test8_c() {
|
|||
}
|
||||
|
||||
@class Test9;
|
||||
void test9_a() {
|
||||
void test9_a(void) {
|
||||
__weak Test9 **(^myBlock)(void);
|
||||
__weak Test9 **var = myBlock();
|
||||
(void) (__strong Test9 **) &myBlock;
|
||||
(void) (__weak Test9 **) &myBlock; // expected-error {{cast}}
|
||||
}
|
||||
void test9_b() {
|
||||
void test9_b(void) {
|
||||
__weak Test9 *(^myBlock)(void);
|
||||
(void) (__weak Test9**) &myBlock;
|
||||
(void) (__strong Test9**) &myBlock; // expected-error {{cast}}
|
||||
}
|
||||
void test9_c() {
|
||||
void test9_c(void) {
|
||||
__weak Test9 *(^*(^myBlock)(void))(void);
|
||||
(void) (__weak Test9 **) myBlock();
|
||||
(void) (__strong Test9 **) myBlock(); // expected-error {{cast}}
|
||||
|
|
|
@ -26,14 +26,14 @@ void test5(struct Test5 *p) {
|
|||
p->field = 0;
|
||||
}
|
||||
|
||||
id test6() {
|
||||
id test6(void) {
|
||||
// This is actually okay to use if declared in a system header.
|
||||
id x;
|
||||
x = (id) kMagicConstant;
|
||||
x = (id) (x ? kMagicConstant : kMagicConstant);
|
||||
x = (id) (x ? kMagicConstant : (void*) 0);
|
||||
|
||||
extern void test6_helper();
|
||||
extern void test6_helper(void);
|
||||
x = (id) (test6_helper(), kMagicConstant);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void test7(Test7 *p) {
|
|||
}
|
||||
|
||||
extern void doSomething(Test9 arg);
|
||||
void test9() {
|
||||
void test9(void) {
|
||||
Test9 foo2 = {0, 0};
|
||||
doSomething(foo2);
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ void from_void(void *vp) {
|
|||
uip = vp; // expected-error{{implicit conversion of a non-Objective-C pointer type 'void *' to '__unsafe_unretained id *' is disallowed with ARC}}
|
||||
}
|
||||
|
||||
typedef void (^Block)();
|
||||
typedef void (^Block_strong)() __strong;
|
||||
typedef void (^Block_autoreleasing)() __autoreleasing;
|
||||
typedef void (^Block)(void);
|
||||
typedef void (^Block_strong)(void) __strong;
|
||||
typedef void (^Block_autoreleasing)(void) __autoreleasing;
|
||||
|
||||
@class NSString;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ __attribute__((objc_arc_weak_reference_unavailable))
|
|||
|
||||
@interface sub : NSOptOut1072 @end // expected-note 2 {{class is declared here}}
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
__weak sub *w2; // expected-error {{class is incompatible with __weak references}}
|
||||
|
||||
__weak NSOptOut1072 *ns1; // expected-error {{class is incompatible with __weak references}}
|
||||
|
@ -26,7 +26,7 @@ __attribute__((objc_arc_weak_reference_unavailable))
|
|||
+ (id) new;
|
||||
@end
|
||||
|
||||
NOWEAK * Test1() {
|
||||
NOWEAK * Test1(void) {
|
||||
NOWEAK * strong1 = [NOWEAK new];
|
||||
__weak id weak1;
|
||||
weak1 = strong1; // expected-error {{assignment of a weak-unavailable object to a __weak object}}
|
||||
|
@ -39,7 +39,7 @@ NOWEAK * Test1() {
|
|||
@protocol P @end
|
||||
@protocol P1 @end
|
||||
|
||||
NOWEAK<P, P1> * Test2() {
|
||||
NOWEAK<P, P1> * Test2(void) {
|
||||
NOWEAK<P, P1> * strong1 = 0;
|
||||
__weak id<P> weak1;
|
||||
weak1 = strong1; // expected-error {{assignment of a weak-unavailable object to a __weak object}}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
# 1 "<command line>"
|
||||
# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
|
||||
id * foo(); // expected-note {{declaration uses type that is ill-formed in ARC}}
|
||||
id * foo(void); // expected-note {{declaration uses type that is ill-formed in ARC}}
|
||||
|
||||
# 1 "arc-unavailable-system-function.m" 2
|
||||
void ret() {
|
||||
void ret(void) {
|
||||
foo(); // expected-error {{'foo' is unavailable in ARC}}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void test1(A *a) {
|
|||
|
||||
@end
|
||||
|
||||
void rdar8861761() {
|
||||
void rdar8861761(void) {
|
||||
B *o1 = [[B alloc] initWithInt:0];
|
||||
B *o2 = [B alloc];
|
||||
[o2 initWithInt:0]; // expected-warning {{expression result unused}}
|
||||
|
@ -105,7 +105,7 @@ void rdar8861761() {
|
|||
- (void)foo:(void (^)(unsigned captureCount, I * const capturedStrings[captureCount]))block;
|
||||
@end
|
||||
|
||||
void test5() {
|
||||
void test5(void) {
|
||||
extern void test5_helper(__autoreleasing id *);
|
||||
id x;
|
||||
|
||||
|
@ -340,7 +340,7 @@ void test12(id collection) {
|
|||
|
||||
// rdar://problem/9172151
|
||||
@class Test14A, Test14B;
|
||||
void test14() {
|
||||
void test14(void) {
|
||||
extern void test14_consume(id *);
|
||||
extern int test14_cond(void);
|
||||
extern float test14_nowriteback(id __autoreleasing const *); // expected-note{{passing argument to parameter here}}
|
||||
|
@ -376,7 +376,7 @@ void test14() {
|
|||
test14_nowriteback(wip); // expected-error{{passing '__weak id *' to parameter of type '__autoreleasing id const *' changes retain/release properties of pointer}}
|
||||
}
|
||||
|
||||
void test15() {
|
||||
void test15(void) {
|
||||
__block __autoreleasing id x; // expected-error {{__block variables cannot have __autoreleasing ownership}}
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ _Bool fn(id obj) {
|
|||
}
|
||||
|
||||
// Check casting w/ ownership qualifiers.
|
||||
void test21() {
|
||||
void test21(void) {
|
||||
__strong id *sip;
|
||||
(void)(__weak id *)sip; // expected-error{{casting '__strong id *' to type '__weak id *' changes retain/release properties of pointer}}
|
||||
(void)(__weak const id *)sip; // expected-error{{casting '__strong id *' to type '__weak id const *' changes retain/release properties of pointer}}
|
||||
|
@ -606,7 +606,7 @@ typedef struct Bark Bark;
|
|||
// rdar://9411838
|
||||
@protocol PTest31 @end
|
||||
|
||||
int Test31() {
|
||||
int Test31(void) {
|
||||
Class cls;
|
||||
id ids;
|
||||
id<PTest31> pids;
|
||||
|
@ -698,7 +698,7 @@ void test37(Test37 *c) {
|
|||
@interface Test38
|
||||
@property int value;
|
||||
@end
|
||||
void test38() {
|
||||
void test38(void) {
|
||||
extern Test38 *test38_helper(void);
|
||||
switch (test38_helper().value) {
|
||||
case 0:
|
||||
|
@ -797,7 +797,7 @@ void foo(NSArray *array) {
|
|||
}
|
||||
|
||||
// rdar://16627903
|
||||
extern void abort();
|
||||
extern void abort(void);
|
||||
#define TKAssertEqual(a, b) do{\
|
||||
__typeof(a) a_res = (a);\
|
||||
__typeof(b) b_res = (b);\
|
||||
|
@ -806,7 +806,7 @@ extern void abort();
|
|||
}\
|
||||
}while(0)
|
||||
|
||||
int garf() {
|
||||
int garf(void) {
|
||||
id object;
|
||||
TKAssertEqual(object, nil);
|
||||
TKAssertEqual(object, (id)nil);
|
||||
|
|
|
@ -13,7 +13,7 @@ extern int charFunc(char); // expected-note{{passing argument to parameter here}
|
|||
:(struct S)s2; // expected-note{{passing argument to parameter 's2' here}}
|
||||
@end
|
||||
|
||||
void test() {
|
||||
void test(void) {
|
||||
id obj = [Test alloc];
|
||||
struct S sInst;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user