Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: msg_245.c,v 1.6 2023/03/28 14:44:35 rillig Exp $	*/
      2 # 3 "msg_245.c"
      3 
      4 // Test for message: incompatible structure pointers: '%s' '%s' '%s' [245]
      5 
      6 /* lint1-extra-flags: -X 351 */
      7 
      8 typedef struct tag_and_typedef_tag {
      9 	int member;
     10 } tag_and_typedef_typedef;
     11 
     12 struct only_tag {
     13 	int member;
     14 };
     15 
     16 typedef struct {
     17 	int member;
     18 } only_typedef;
     19 
     20 struct {
     21 	int member;
     22 } unnamed;
     23 
     24 void sink_bool(_Bool);
     25 
     26 void
     27 example(tag_and_typedef_typedef both,
     28 	only_typedef only_typedef,
     29 	struct only_tag only_tag)
     30 {
     31 	/* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct only_tag' [245] */
     32 	sink_bool(&both == &only_tag);
     33 	/* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct typedef only_typedef' [245] */
     34 	sink_bool(&both == &only_typedef);
     35 	/* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct <unnamed>' [245] */
     36 	sink_bool(&both == &unnamed);
     37 }
     38