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);
10 char *strdup (const char *);
11 size_t strlen (const char *);
12 void *memcpy (void *__restrict
, const void *__restrict
, size_t);
13 char *strcpy (char *__restrict
, const char *__restrict
);
14 char *strcat (char *__restrict
, const char *__restrict
);
15 char *strchr (const char *, int);
16 void *memset (void *, int, size_t);
17 int memcmp (const void *, const void *, size_t);
18 int strcmp (const char *, const char *);
20 void *mempcpy (void *__restrict
, const void *__restrict
, size_t);
21 char *stpcpy (char *__restrict
, const char *__restrict
);
24 #if defined(FORTIFY_SOURCE) && FORTIFY_SOURCE > 0 && __OPTIMIZE__
25 # define bos(ptr) __builtin_object_size (ptr, FORTIFY_SOURCE > 0)
26 # define bos0(ptr) __builtin_object_size (ptr, 0)
28 extern inline __attribute__((gnu_inline
, always_inline
, artificial
)) void *
29 memcpy (void *__restrict dest
, const void *__restrict src
, size_t len
)
31 return __builtin___memcpy_chk (dest
, src
, len
, bos0 (dest
));
34 extern inline __attribute__((gnu_inline
, always_inline
, artificial
)) char *
35 strcpy (char *__restrict dest
, const char *__restrict src
)
37 return __builtin___strcpy_chk (dest
, src
, bos (dest
));
40 extern inline __attribute__((gnu_inline
, always_inline
, artificial
)) char *
41 strcat (char *__restrict dest
, const char *__restrict src
)
43 return __builtin___strcat_chk (dest
, src
, bos (dest
));
47 extern inline __attribute__((gnu_inline
, always_inline
, artificial
)) void *
48 mempcpy (void *__restrict dest
, const void *__restrict src
, size_t len
)
50 return __builtin___mempcpy_chk (dest
, src
, len
, bos0 (dest
));
53 extern inline __attribute__((gnu_inline
, always_inline
, artificial
)) char *
54 stpcpy (char *__restrict dest
, const char *__restrict src
)
56 return __builtin___stpcpy_chk (dest
, src
, bos (dest
));