Home | History | Annotate | Line # | Download | only in lint1
msg_155.c revision 1.3
      1 /*	$NetBSD: msg_155.c,v 1.3 2021/06/28 10:07:43 rillig Exp $	*/
      2 # 3 "msg_155.c"
      3 
      4 // Test for message: argument is incompatible with prototype, arg #%d [155]
      5 // TODO: Add type information to the message
      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: argument is incompatible with prototype, arg #1 */
     25 	c99_6_7_6_example_a(arg);
     26 
     27 	/* expect+1: argument is incompatible with prototype, arg #1 */
     28 	c99_6_7_6_example_b(arg);
     29 
     30 	/* expect+1: argument is incompatible with prototype, arg #1 */
     31 	c99_6_7_6_example_c(arg);
     32 
     33 	/* expect+1: argument is incompatible with prototype, arg #1 */
     34 	c99_6_7_6_example_d(arg);
     35 
     36 	/* FIXME: no warning or error at all for an undefined function? */
     37 	c99_6_7_6_example_e(arg);
     38 
     39 	/* FIXME: no warning or error at all for an undefined function? */
     40 	c99_6_7_6_example_f(arg);
     41 
     42 	/* expect+1: argument is incompatible with prototype, arg #1 */
     43 	c99_6_7_6_example_g(arg);
     44 
     45 	/* expect+1: argument is incompatible with prototype, arg #1 */
     46 	c99_6_7_6_example_h(arg);
     47 }
     48