libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Wbuiltin-declaration-mismatch-13.c
blobf21f407e181852136a0c3f866ad8e7999d8404f8
1 /* PR middle-end/93926 - ICE on a built-in redeclaration returning an integer
2 instead of a pointer
3 { dg-do compile }
4 { dg-options "-Wall" } */
6 typedef __SIZE_TYPE__ size_t;
8 void* ret_calloc (size_t n1, size_t n2)
10 extern size_t calloc (size_t, size_t); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
12 return (void *) calloc (n1, n2);
15 void* ret_malloc (size_t n)
17 extern size_t malloc (size_t); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
19 return (void *) malloc (n);
22 void* ret_realloc (void *p, size_t n)
24 extern size_t realloc (void *p, size_t); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
26 return (void *) realloc (p, n);
29 void* ret_strdup (const char *s)
31 extern size_t strdup (const char*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
33 return (void *) strdup (s);
36 void* ret_strndup (const char *s, size_t n)
38 extern size_t
39 strndup (const char*, size_t); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
41 return (void *) strndup (s, n);
44 // For good measure also exerise strcmp return type (not part of the bug).
46 char* ret_strcmp (const char *s, const char *t)
48 extern char*
49 strcmp (const char*, const char*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
51 return strcmp (s, t);
54 // Exercise warnings for pointer/integer mismatches in argument types
55 // (also not part of the bug).
57 char* ret_strcat (size_t s, const char *t)
59 extern char*
60 strcat (size_t, const char*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
62 return strcat (s, t);
65 char* ret_strcpy (char *s, size_t t)
67 extern char* strcpy (char*, size_t); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
69 return strcpy (s, t);
72 char* ret_strncpy (char *s, const char *t, size_t n)
74 extern char*
75 strncpy (char*, size_t, const char*); // { dg-warning "\\\[-Wbuiltin-declaration-mismatch" }
77 return strncpy (s, n, t);