Home | History | Annotate | Line # | Download | only in lint1
msg_155.c revision 1.6
      1 /*	$NetBSD: msg_155.c,v 1.6 2021/06/28 11:09:35 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 (*)[*]);
     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 	/* expect+1: 'pointer to array[unknown_size] of int' */
     38 	c99_6_7_6_example_e(arg);
     39 
     40 	/* TODO: C99 says 'function with no parameter specification returning a pointer to int' */
     41 	/* FIXME: no warning or error at all for an undefined function? */
     42 	c99_6_7_6_example_f(arg);
     43 
     44 	/* expect+1: 'pointer to function(void) returning int' */
     45 	c99_6_7_6_example_g(arg);
     46 
     47 	/* expect+1: 'pointer to const pointer to function(unsigned int, ...) returning int' */
     48 	c99_6_7_6_example_h(arg);
     49 }
     50