1 /* Test to verify that calls to common built-in functions declared
2 with no prototype do not cause an ICE.
4 { dg-options "-O2 -Wall -Wextra" }
5 { dg-prune-output "warning" }
6 { dg-require-effective-target alloca } */
8 typedef __SIZE_TYPE__
size_t;
15 #define NO_PROTO /* empty */
18 /* Character classification built-ins from <ctype.h>. */
19 int isalpha (NO_PROTO
);
20 int isalnum (NO_PROTO
);
21 int isalpha (NO_PROTO
);
22 int iscntrl (NO_PROTO
);
23 int isdigit (NO_PROTO
);
24 int isgraph (NO_PROTO
);
25 int islower (NO_PROTO
);
26 int isprint (NO_PROTO
);
27 int ispunct (NO_PROTO
);
28 int isspace (NO_PROTO
);
29 int isupper (NO_PROTO
);
30 int isxdigit (NO_PROTO
);
31 int tolower (NO_PROTO
);
32 int toupper (NO_PROTO
);
34 /* Memory allocation built-ins from <stdlib.h>. */
35 void* alloca (NO_PROTO
);
36 void* aligned_alloc (NO_PROTO
);
37 void* calloc (NO_PROTO
);
38 void* malloc (NO_PROTO
);
39 void* realloc (NO_PROTO
);
41 /* Raw memory built-ins from <string.h>. */
42 void* memcpy (NO_PROTO
);
43 void* memchr (NO_PROTO
);
44 void* memmove (NO_PROTO
);
45 void* mempcpy (NO_PROTO
);
46 void* memset (NO_PROTO
);
48 /* String built-ins from <string.h>. */
49 char* stpcpy (NO_PROTO
);
50 char* stpncpy (NO_PROTO
);
52 char* strcat (NO_PROTO
);
53 char* strcpy (NO_PROTO
);
55 char* strdup (NO_PROTO
);
56 char* strndup (NO_PROTO
);
58 char* strncat (NO_PROTO
);
59 char* strncpy (NO_PROTO
);
61 size_t strlen (NO_PROTO
);
62 size_t strnlen (NO_PROTO
);
64 char* strchr (NO_PROTO
);
65 int strcmp (NO_PROTO
);
66 int strncmp (NO_PROTO
);
68 /* Input/output functions from <stdio.h>. */
73 int fscanf (NO_PROTO
);
74 int sscanf (NO_PROTO
);
75 int vfscanf (NO_PROTO
);
76 int vsscanf (NO_PROTO
);
78 int printf (NO_PROTO
);
79 int fprintf (NO_PROTO
);
80 int sprintf (NO_PROTO
);
82 int snprintf (NO_PROTO
);
84 int vprintf (NO_PROTO
);
85 int vfprintf (NO_PROTO
);
86 int vsprintf (NO_PROTO
);
88 int vsnprintf (NO_PROTO
);
95 #define CONCAT(a, b) a ## b
96 #define UNIQ_NAME(func, id) CONCAT (test_ ## func ## _, id)
98 #define TEST_FUNC(func, arglist) \
99 __typeof__ (func arglist) \
100 UNIQ_NAME (func, __COUNTER__) (void) { \
101 return func arglist; \
105 TEST_FUNC (func, ()); \
106 TEST_FUNC (func, (1)); \
107 TEST_FUNC (func, ("")); \
108 TEST_FUNC (func, ((void*)1)); \
109 TEST_FUNC (func, (iarr)); \
110 TEST_FUNC (func, (function))
113 TEST_FUNC (func, (1, 1)); \
114 TEST_FUNC (func, (1, "")); \
115 TEST_FUNC (func, (1, (void*)1)); \
116 TEST_FUNC (func, (1, iarr)); \
117 TEST_FUNC (func, (1, function))
120 TEST_FUNC (func, (1, 1, 1)); \
121 TEST_FUNC (func, (1, 1, "")); \
122 TEST_FUNC (func, (1, 1, (void*)1)); \
123 TEST_FUNC (func, (1, 1, iarr)); \
124 TEST_FUNC (func, (1, 1, function))
127 extern void function (void);