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-additional-options "-fpermissive" { target c } }
6 { dg-prune-output "warning" }
7 { dg-require-effective-target alloca } */
9 typedef __SIZE_TYPE__
size_t;
16 #define NO_PROTO /* empty */
19 /* Character classification built-ins from <ctype.h>. */
20 int isalpha (NO_PROTO
);
21 int isalnum (NO_PROTO
);
22 int isalpha (NO_PROTO
);
23 int iscntrl (NO_PROTO
);
24 int isdigit (NO_PROTO
);
25 int isgraph (NO_PROTO
);
26 int islower (NO_PROTO
);
27 int isprint (NO_PROTO
);
28 int ispunct (NO_PROTO
);
29 int isspace (NO_PROTO
);
30 int isupper (NO_PROTO
);
31 int isxdigit (NO_PROTO
);
32 int tolower (NO_PROTO
);
33 int toupper (NO_PROTO
);
35 /* Memory allocation built-ins from <stdlib.h>. */
36 void* alloca (NO_PROTO
);
37 void* aligned_alloc (NO_PROTO
);
38 void* calloc (NO_PROTO
);
39 void* malloc (NO_PROTO
);
40 void* realloc (NO_PROTO
);
42 /* Raw memory built-ins from <string.h>. */
43 void* memcpy (NO_PROTO
);
44 void* memchr (NO_PROTO
);
45 void* memmove (NO_PROTO
);
46 void* mempcpy (NO_PROTO
);
47 void* memset (NO_PROTO
);
49 /* String built-ins from <string.h>. */
50 char* stpcpy (NO_PROTO
);
51 char* stpncpy (NO_PROTO
);
53 char* strcat (NO_PROTO
);
54 char* strcpy (NO_PROTO
);
56 char* strdup (NO_PROTO
);
57 char* strndup (NO_PROTO
);
59 char* strncat (NO_PROTO
);
60 char* strncpy (NO_PROTO
);
62 size_t strlen (NO_PROTO
);
63 size_t strnlen (NO_PROTO
);
65 char* strchr (NO_PROTO
);
66 int strcmp (NO_PROTO
);
67 int strncmp (NO_PROTO
);
69 /* Input/output functions from <stdio.h>. */
74 int fscanf (NO_PROTO
);
75 int sscanf (NO_PROTO
);
76 int vfscanf (NO_PROTO
);
77 int vsscanf (NO_PROTO
);
79 int printf (NO_PROTO
);
80 int fprintf (NO_PROTO
);
81 int sprintf (NO_PROTO
);
83 int snprintf (NO_PROTO
);
85 int vprintf (NO_PROTO
);
86 int vfprintf (NO_PROTO
);
87 int vsprintf (NO_PROTO
);
89 int vsnprintf (NO_PROTO
);
96 #define CONCAT(a, b) a ## b
97 #define UNIQ_NAME(func, id) CONCAT (test_ ## func ## _, id)
99 #define TEST_FUNC(func, arglist) \
100 __typeof__ (func arglist) \
101 UNIQ_NAME (func, __COUNTER__) (void) { \
102 return func arglist; \
106 TEST_FUNC (func, ()); \
107 TEST_FUNC (func, (1)); \
108 TEST_FUNC (func, ("")); \
109 TEST_FUNC (func, ((void*)1)); \
110 TEST_FUNC (func, (iarr)); \
111 TEST_FUNC (func, (function))
114 TEST_FUNC (func, (1, 1)); \
115 TEST_FUNC (func, (1, "")); \
116 TEST_FUNC (func, (1, (void*)1)); \
117 TEST_FUNC (func, (1, iarr)); \
118 TEST_FUNC (func, (1, function))
121 TEST_FUNC (func, (1, 1, 1)); \
122 TEST_FUNC (func, (1, 1, "")); \
123 TEST_FUNC (func, (1, 1, (void*)1)); \
124 TEST_FUNC (func, (1, 1, iarr)); \
125 TEST_FUNC (func, (1, 1, function))
128 extern void function (void);