1 /* $NetBSD: msg_155.c,v 1.5 2021/06/28 10:29:05 rillig Exp $ */ 2 # 3 "msg_155.c" 3 4 // Test for message: passing '%s' to incompatible '%s', arg #%d [155] 5 6 7 void c99_6_7_6_example_a(int); 8 void c99_6_7_6_example_b(int *); 9 void c99_6_7_6_example_c(int *[3]); 10 void c99_6_7_6_example_d(int (*)[3]); 11 void c99_6_7_6_example_e(int (*)[*]); /* expect: syntax error ']' *//* FIXME */ 12 // FIXME: assertion "sym->s_type != NULL" failed in declare_argument at decl.c:2436 13 // void c99_6_7_6_example_f(int *()); 14 void c99_6_7_6_example_g(int (*)(void)); 15 void c99_6_7_6_example_h(int (*const[])(unsigned int, ...)); 16 17 struct incompatible { 18 int member; 19 }; 20 21 void 22 provoke_error_messages(struct incompatible arg) 23 { 24 /* expect+1: 'int' */ 25 c99_6_7_6_example_a(arg); 26 27 /* expect+1: 'pointer to int' */ 28 c99_6_7_6_example_b(arg); 29 30 /* C99 says 'array[3] of pointer to int', which is close enough. */ 31 /* expect+1: 'pointer to pointer to int' */ 32 c99_6_7_6_example_c(arg); 33 34 /* expect+1: 'pointer to array[3] of int' */ 35 c99_6_7_6_example_d(arg); 36 37 /* TODO: C99 says 'pointer to a variable length array of an unspecified number of ints' */ 38 /* FIXME: no warning or error at all for an undefined function? */ 39 c99_6_7_6_example_e(arg); 40 41 /* TODO: C99 says 'function with no parameter specification returning a pointer to int' */ 42 /* FIXME: no warning or error at all for an undefined function? */ 43 c99_6_7_6_example_f(arg); 44 45 /* expect+1: 'pointer to function(void) returning int' */ 46 c99_6_7_6_example_g(arg); 47 48 /* expect+1: 'pointer to const pointer to function(unsigned int, ...) returning int' */ 49 c99_6_7_6_example_h(arg); 50 } 51