Home | History | Annotate | Line # | Download | only in lint1
msg_215.c revision 1.12
      1 /*	$NetBSD: msg_215.c,v 1.12 2022/06/22 19:23:18 rillig Exp $	*/
      2 # 3 "msg_215.c"
      3 
      4 // Test for message: function '%s' implicitly declared to return int [215]
      5 
      6 /*
      7  * In traditional C and C90, it was possible to implicitly declare a function
      8  * by just calling it, without defining a prototype first.  Such a function
      9  * would then be defined as taking unspecified parameters and returning int.
     10  */
     11 
     12 struct str {
     13 	int dummy;
     14 };
     15 
     16 /* ARGSUSED */
     17 void
     18 test(struct str str, const double *p_double)
     19 {
     20 	/* expect+1: error: function 'name' implicitly declared to return int [215] */
     21 	name();
     22 
     23 	/* expect+2: error: 'parenthesized' undefined [99] */
     24 	/* expect+1: error: cannot call 'int', must be a function [149] */
     25 	(parenthesized)();
     26 
     27 	/* expect+2: error: type 'struct str' does not have member 'member' [101] */
     28 	/* expect+1: error: cannot call 'int', must be a function [149] */
     29 	str.member();
     30 
     31 	/* https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html */
     32 	__builtin_whatever(123, "string");
     33 	__atomic_whatever(123, "string");
     34 	/* obsolete but still in use, as of 2021 */
     35 	__sync_whatever(123, "string");
     36 
     37 	/* https://software.intel.com/sites/landingpage/IntrinsicsGuide/ */
     38 	_mm_load_sd(p_double);
     39 }
     40