diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -5527,7 +5527,7 @@ InGroup>, DefaultIgnore; def warn_call_function_without_prototype : Warning< "calling function %0 with arguments when function has no prototype">, InGroup< - DiagGroup<"strict-calls-without-prototype">>, DefaultIgnore; + DiagGroup<"strict-calls-without-prototype">>; def warn_missing_variable_declarations : Warning< "no previous extern declaration for non-static variable %0">, InGroup>, DefaultIgnore; diff --git a/clang/test/Analysis/casts.c b/clang/test/Analysis/casts.c --- a/clang/test/Analysis/casts.c +++ b/clang/test/Analysis/casts.c @@ -16,7 +16,7 @@ struct sockaddr { sa_family_t sa_family; }; struct sockaddr_storage {}; -void getsockname(); +void getsockname(int, struct sockaddr *, socklen_t *); #ifndef EAGERLY_ASSUME diff --git a/clang/test/Analysis/inline.c b/clang/test/Analysis/inline.c --- a/clang/test/Analysis/inline.c +++ b/clang/test/Analysis/inline.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -Wno-strict-calls-without-prototype %s void clang_analyzer_eval(int); void clang_analyzer_checkInlined(int); diff --git a/clang/test/Analysis/misc-ps-region-store.m b/clang/test/Analysis/misc-ps-region-store.m --- a/clang/test/Analysis/misc-ps-region-store.m +++ b/clang/test/Analysis/misc-ps-region-store.m @@ -294,7 +294,7 @@ struct ArrayWrapper { unsigned char y[16]; }; struct WrappedStruct { unsigned z; }; -void test_handle_array_wrapper_helper(); +void test_handle_array_wrapper_helper(struct ArrayWrapper *); int test_handle_array_wrapper() { struct ArrayWrapper x; diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m --- a/clang/test/Analysis/misc-ps.m +++ b/clang/test/Analysis/misc-ps.m @@ -461,7 +461,7 @@ (void (^)(void *))test_block_cast_aux(); // expected-warning{{expression result unused}} } -int OSAtomicCompareAndSwap32Barrier(); +int OSAtomicCompareAndSwap32Barrier(int, int, int *); // Test comparison of 'id' instance variable to a null void* constant after // performing an OSAtomicCompareAndSwap32Barrier. @@ -507,7 +507,7 @@ return; } -int ivar_getOffset(); +int ivar_getOffset(Ivar); // Reduced from a crash involving the cast of an Objective-C symbolic region to // 'char *' diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c --- a/clang/test/Analysis/null-deref-ps.c +++ b/clang/test/Analysis/null-deref-ps.c @@ -188,7 +188,7 @@ *q = 1; // no-warning } -int* qux(); +int *qux(unsigned); int f9(unsigned len) { assert (len != 0); diff --git a/clang/test/Analysis/solver-sym-simplification-adjustment.c b/clang/test/Analysis/solver-sym-simplification-adjustment.c --- a/clang/test/Analysis/solver-sym-simplification-adjustment.c +++ b/clang/test/Analysis/solver-sym-simplification-adjustment.c @@ -5,7 +5,7 @@ // RUN: -verify void clang_analyzer_warnIfReached(); -void clang_analyzer_eval(); +void clang_analyzer_eval(int); void test_simplification_adjustment_concrete_int(int b, int c) { if (b < 0 || b > 1) // b: [0,1] diff --git a/clang/test/Analysis/solver-sym-simplification-concreteint.c b/clang/test/Analysis/solver-sym-simplification-concreteint.c --- a/clang/test/Analysis/solver-sym-simplification-concreteint.c +++ b/clang/test/Analysis/solver-sym-simplification-concreteint.c @@ -5,7 +5,7 @@ // RUN: -verify void clang_analyzer_warnIfReached(); -void clang_analyzer_eval(); +void clang_analyzer_eval(int); void test_simplification_to_concrete_int_infeasible(int b, int c) { if (c + b != 0) // c + b == 0 diff --git a/clang/test/CodeGen/functions.c b/clang/test/CodeGen/functions.c --- a/clang/test/CodeGen/functions.c +++ b/clang/test/CodeGen/functions.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify | FileCheck %s +// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify -Wno-strict-calls-without-prototype | FileCheck %s int g(); diff --git a/clang/test/Sema/arg-duplicate.c b/clang/test/Sema/arg-duplicate.c --- a/clang/test/Sema/arg-duplicate.c +++ b/clang/test/Sema/arg-duplicate.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-calls-without-prototype %s int f3(y, x, x) // expected-error {{redefinition of parameter}} diff --git a/clang/test/Sema/block-misc.c b/clang/test/Sema/block-misc.c --- a/clang/test/Sema/block-misc.c +++ b/clang/test/Sema/block-misc.c @@ -157,7 +157,8 @@ __block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}} } -void f(); +void f(void (*)(int)); +void f2(void (^)(int)); void test17() { void (^bp)(int); @@ -167,7 +168,7 @@ f(1 ? bp : vp); f(1 ? vp : bp); - f(1 ? bp : bp1); + f2(1 ? bp : bp1); (void)(bp > rp); // expected-error {{invalid operands}} (void)(bp > 0); // expected-error {{invalid operands}} (void)(bp > bp); // expected-error {{invalid operands}} diff --git a/clang/test/Sema/extern-redecl.c b/clang/test/Sema/extern-redecl.c --- a/clang/test/Sema/extern-redecl.c +++ b/clang/test/Sema/extern-redecl.c @@ -81,8 +81,8 @@ void test6_fn1(); void test6_fn2(); test6_fn1(1.2); // expected-error {{passing 'double' to parameter of incompatible type 'int *'}} - // FIXME: This is valid, but we should warn on it. - test6_fn2(1.2); + test6_fn2(1.2); // expected-warning{{calling function 'test6_fn2' with arguments when function has no prototype}} + // expected-note@-3{{'test6_fn2' declared here}} } } } diff --git a/clang/test/Sema/function-redecl.c b/clang/test/Sema/function-redecl.c --- a/clang/test/Sema/function-redecl.c +++ b/clang/test/Sema/function-redecl.c @@ -120,7 +120,8 @@ a x; a2 x2; // expected-note{{passing argument to parameter here}} void test_x() { - x(5); + x(5); // expected-warning{{calling function 'x' with arguments when function has no prototype}} + // expected-note@-4{{'x' declared here}} x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}} } diff --git a/clang/test/Sema/function.c b/clang/test/Sema/function.c --- a/clang/test/Sema/function.c +++ b/clang/test/Sema/function.c @@ -27,8 +27,11 @@ // PR2042 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-calls-without-prototype" void t10(){} void t11(){t10(1);} // expected-warning{{too many arguments}} +#pragma clang diagnostic pop // PR3208 void t12(int) {} // c2x-warning{{omitting the parameter name in a function definition is a C2x extension}} diff --git a/clang/test/Sema/knr-def-call.c b/clang/test/Sema/knr-def-call.c --- a/clang/test/Sema/knr-def-call.c +++ b/clang/test/Sema/knr-def-call.c @@ -3,11 +3,15 @@ // C DR #316, PR 3626. void f0(a, b, c, d) int a,b,c,d; {} void t0(void) { + // expected-warning@+2{{calling function 'f0' with arguments when function has no prototype}} + // expected-note@-3{{'f0' declared here}} f0(1); // expected-warning{{too few arguments}} } void f1(a, b) int a, b; {} void t1(void) { + // expected-warning@+2{{calling function 'f1' with arguments when function has no prototype}} + // expected-note@-3{{'f1' declared here}} f1(1, 2, 3); // expected-warning{{too many arguments}} } @@ -36,6 +40,9 @@ } void use_proto() { + // FIXME(dliew): Perhaps we shouldn't warn about this? + // expected-warning@+2{{calling function 'proto' with arguments when function has no prototype}} + // expected-note@-8{{'proto' declared here}} proto(42.1); // expected-warning{{implicit conversion from 'double' to 'int' changes value from 42.1 to 42}} (&proto)(42.1); // expected-warning{{implicit conversion from 'double' to 'int' changes value from 42.1 to 42}} } diff --git a/clang/test/Sema/knr-variadic-def.c b/clang/test/Sema/knr-variadic-def.c --- a/clang/test/Sema/knr-variadic-def.c +++ b/clang/test/Sema/knr-variadic-def.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wno-strict-calls-without-prototype %s // expected-no-diagnostics // PR4287 diff --git a/clang/test/Sema/merge-decls.c b/clang/test/Sema/merge-decls.c --- a/clang/test/Sema/merge-decls.c +++ b/clang/test/Sema/merge-decls.c @@ -76,6 +76,9 @@ return sizeof(*x); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}} } +// FIXME(dliew): shouldn't warn here +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-calls-without-prototype" void test6_f(int (*a)[11]); void test6_f(a) int (*a)[]; @@ -84,6 +87,7 @@ int arr[10]; test6_f(&arr); // expected-warning {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}} } +#pragma clang diagnostic pop void test7_f(int (*)[10]); void test7_f(int (*)[]); // expected-note {{passing argument to parameter here}} diff --git a/clang/test/Sema/sizeless-1.c b/clang/test/Sema/sizeless-1.c --- a/clang/test/Sema/sizeless-1.c +++ b/clang/test/Sema/sizeless-1.c @@ -42,7 +42,7 @@ void __attribute__((overloadable)) overf16(svint16_t); // expected-note + {{not viable}} void __attribute__((overloadable)) overf16(int); // expected-note + {{not viable}} -void noproto(); +void noproto(); // expected-note{{'noproto' declared here}} void varargs(int, ...); void unused() { @@ -174,7 +174,7 @@ overf16(local_int8); // expected-error {{no matching function}} overf16(local_int16); - noproto(local_int8); + noproto(local_int8); // expected-warning{{calling function 'noproto' with arguments when function has no prototype}} varargs(1, local_int8, local_int16); global_int8_ptr++; // expected-error {{arithmetic on a pointer to sizeless type}} diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c --- a/clang/test/Sema/unused-expr.c +++ b/clang/test/Sema/unused-expr.c @@ -79,10 +79,9 @@ t5f(); // expected-warning {{ignoring return value of function declared with 'warn_unused_result' attribute}} } - int fn1() __attribute__ ((warn_unused_result)); -int fn2() __attribute__ ((pure)); -int fn3() __attribute__ ((__const)); +int fn2(int, int) __attribute__((pure)); +int fn3(int) __attribute__((__const)); // rdar://6587766 int t6() { if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings @@ -129,18 +128,18 @@ #define NOP(a) (a) #define M1(a, b) (long)foo((a), (b)) #define M2 (long)0; -#define M3(a) (t3(a), fn2()) +#define M3(a) (t3(a), fn2(0, 1)) #define M4(a, b) (foo((a), (b)) ? 0 : t3(a), 1) #define M5(a, b) (foo((a), (b)), 1) #define M6() fn1() -#define M7() fn2() +#define M7() fn2(0, 1) void t11(int i, int j) { M1(i, j); // no warning NOP((long)foo(i, j)); // expected-warning {{expression result unused}} M2; // no warning NOP((long)0); // expected-warning {{expression result unused}} M3(i); // no warning - NOP((t3(i), fn2())); // expected-warning {{ignoring return value}} + NOP((t3(i), fn2(0, 0))); // expected-warning {{ignoring return value}} M4(i, j); // no warning NOP((foo(i, j) ? 0 : t3(i), 1)); // expected-warning {{expression result unused}} M5(i, j); // no warning diff --git a/clang/test/SemaObjC/nonnull.m b/clang/test/SemaObjC/nonnull.m --- a/clang/test/SemaObjC/nonnull.m +++ b/clang/test/SemaObjC/nonnull.m @@ -23,8 +23,8 @@ extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1))) __attribute__((nonnull(2))); -void func6(); -void func7(); +void func6(NSObject *); +void func7(NSObject *); void foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)()) @@ -63,7 +63,7 @@ __attribute__((nonnull)) void _dispatch_queue_push_list(dispatch_object_t _head); // no warning -void func6(dispatch_object_t _head) { +void func8(dispatch_object_t _head) { _dispatch_queue_push_list(0); // expected-warning {{null passed to a callee that requires a non-null argument}} _dispatch_queue_push_list(_head._do); // no warning } diff --git a/clang/test/SemaObjC/protocol-archane.m b/clang/test/SemaObjC/protocol-archane.m --- a/clang/test/SemaObjC/protocol-archane.m +++ b/clang/test/SemaObjC/protocol-archane.m @@ -5,6 +5,8 @@ - (void) bar; @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-calls-without-prototype" void bar(); void foo(id x) { bar((short)x); // expected-error {{expected ')'}} expected-note {{to match this '('}} @@ -12,6 +14,7 @@ [()x bar]; // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}} } +#pragma clang diagnostic pop @protocol MyProtocol - (void)doSomething;