knr-def-call.c revision 447234dd459a00a5ed9b7c3e066162cd7a75bf2d
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3// C DR #316, PR 3626. 4void f0(a, b, c, d) int a,b,c,d; {} 5void t0(void) { 6 f0(1); // expected-warning{{too few arguments}} 7} 8 9void f1(a, b) int a, b; {} 10void t1(void) { 11 f1(1, 2, 3); // expected-warning{{too many arguments}} 12} 13 14void f2(float); // expected-note{{previous declaration is here}} 15void f2(x) float x; { } // expected-warning{{promoted type 'double' of K&R function parameter is not compatible with the parameter type 'float' declared in a previous prototype}} 16 17typedef void (*f3)(void); 18f3 t3(int b) { return b? f0 : f1; } // okay 19 20// <rdar://problem/8193107> 21void f4() { 22 char *rindex(); 23} 24 25char *rindex(s, c) 26 register char *s, c; // expected-warning{{promoted type 'char *' of K&R function parameter is not compatible with the parameter type 'char const *' declared in a previous prototype}} 27{ 28 return 0; 29} 30