OSDN Git Service

* config/i386/i386.md (UNSPEC_VSIBADDR): New.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / strlenopt.h
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.  */
4
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 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 *);
19 #ifdef USE_GNU
20 void *mempcpy (void *__restrict, const void *__restrict, size_t);
21 char *stpcpy (char *__restrict, const char *__restrict);
22 #endif
23
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)
27
28 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
29 memcpy (void *__restrict dest, const void *__restrict src, size_t len)
30 {
31   return __builtin___memcpy_chk (dest, src, len, bos0 (dest));
32 }
33
34 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
35 strcpy (char *__restrict dest, const char *__restrict src)
36 {
37   return __builtin___strcpy_chk (dest, src, bos (dest));
38 }
39
40 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
41 strcat (char *__restrict dest, const char *__restrict src)
42 {
43   return __builtin___strcat_chk (dest, src, bos (dest));
44 }
45
46 # ifdef USE_GNU
47 extern inline __attribute__((gnu_inline, always_inline, artificial)) void *
48 mempcpy (void *__restrict dest, const void *__restrict src, size_t len)
49 {
50   return __builtin___mempcpy_chk (dest, src, len, bos0 (dest));
51 }
52
53 extern inline __attribute__((gnu_inline, always_inline, artificial)) char *
54 stpcpy (char *__restrict dest, const char *__restrict src)
55 {
56   return __builtin___stpcpy_chk (dest, src, bos (dest));
57 }
58 # endif
59 #endif