Document gcov-io (PR gcov-profile/84735).
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt.h
blob8f69940b027735ecd1ffeaa8ec47d28f9617c55f
1 /* This is a replacement of needed parts from stdlib.h and string.h
2 for -foptimize-strlen testing, to ensure we are testing the builtins
3 rather than whatever the OS has in its headers. */
5 #define NULL ((void *) 0)
6 typedef __SIZE_TYPE__ size_t;
7 extern void abort (void);
8 void *malloc (size_t);
9 void free (void *);
10 char *strdup (const char *);
11 size_t strlen (const char *);
12 void *memcpy (void *__restrict, const void *__restrict, size_t);
13 void *memmove (void *, const void *, size_t);
14 char *strcpy (char *__restrict, const char *__restrict);
15 char *strcat (char *__restrict, const char *__restrict);
16 char *strchr (const char *, int);
17 void *memset (void *, int, size_t);
18 int memcmp (const void *, const void *, size_t);
19 int strcmp (const char *, const char *);
20 #ifdef USE_GNU
21 void *mempcpy (void *__restrict, const void *__restrict, size_t);
22 char *stpcpy (char *__restrict, const char *__restrict);
23 #endif
25 #if defined(FORTIFY_SOURCE) && FORTIFY_SOURCE > 0 && __OPTIMIZE__
26 # define bos(ptr) __builtin_object_size (ptr, FORTIFY_SOURCE > 0)
27 # define bos0(ptr) __builtin_object_size (ptr, 0)
29 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
30 memcpy (void *__restrict dest, const void *__restrict src, size_t len)
32 return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
35 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
36 memmove (void *dest, const void *src, size_t len)
38 return __builtin___memmove_chk (dest, src, len, bos0 (dest));
41 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
42 strcpy (char *__restrict dest, const char *__restrict src)
44 return __builtin___strcpy_chk (dest, src, bos (dest));
47 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
48 strcat (char *__restrict dest, const char *__restrict src)
50 return __builtin___strcat_chk (dest, src, bos (dest));
53 # ifdef USE_GNU
54 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
55 mempcpy (void *__restrict dest, const void *__restrict src, size_t len)
57 return __builtin___mempcpy_chk (dest, src, len, bos0 (dest));
60 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
61 stpcpy (char *__restrict dest, const char *__restrict src)
63 return __builtin___stpcpy_chk (dest, src, bos (dest));
65 # endif
66 #endif