xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_215.c (revision e6298b924c5ba98f3a22919b56dab04a87cdbb1c)
1 /*	$NetBSD: msg_215.c,v 1.13 2023/07/07 19:45:22 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 /* lint1-extra-flags: -X 351 */
13 
14 struct str {
15 	int dummy;
16 };
17 
18 /* ARGSUSED */
19 void
test(struct str str,const double * p_double)20 test(struct str str, const double *p_double)
21 {
22 	/* expect+1: error: function 'name' implicitly declared to return int [215] */
23 	name();
24 
25 	/* expect+2: error: 'parenthesized' undefined [99] */
26 	/* expect+1: error: cannot call 'int', must be a function [149] */
27 	(parenthesized)();
28 
29 	/* expect+2: error: type 'struct str' does not have member 'member' [101] */
30 	/* expect+1: error: cannot call 'int', must be a function [149] */
31 	str.member();
32 
33 	/* https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html */
34 	__builtin_whatever(123, "string");
35 	__atomic_whatever(123, "string");
36 	/* obsolete but still in use, as of 2021 */
37 	__sync_whatever(123, "string");
38 
39 	/* https://software.intel.com/sites/landingpage/IntrinsicsGuide/ */
40 	_mm_load_sd(p_double);
41 }
42