blob: 048fdba8f6d88f6a477a3e0e3b0d6e43625b0fa4 [file] [log] [blame]
Daniel Dunbar67588922011-11-16 22:40:57 +00001/* ===-- string.h - stub SDK header for compiler-rt -------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===-----------------------------------------------------------------------===
9 *
10 * This is a stub SDK header file. This file is not part of the interface of
11 * this library nor an official version of the appropriate SDK header. It is
12 * intended only to stub the features of this header required by compiler-rt.
13 *
14 * ===-----------------------------------------------------------------------===
15 */
16
17#ifndef __STRING_H__
18#define __STRING_H__
19
20typedef __SIZE_TYPE__ size_t;
21
Benjamin Kramerfa3eee42012-03-30 21:37:08 +000022int memcmp(const void *, const void *, size_t);
23void *memcpy(void *, const void *, size_t);
Bill Wendling2a46a602013-05-15 21:31:22 +000024void *memset(void *, int, size_t);
Daniel Dunbar67588922011-11-16 22:40:57 +000025char *strcat(char *, const char *);
26char *strcpy(char *, const char *);
27char *strdup(const char *);
28size_t strlen(const char *);
29char *strncpy(char *, const char *, size_t);
30
Bill Wendlingda8596b2013-06-27 21:17:24 +000031/* Determine the appropriate strerror() function. */
32#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
33# if defined(__i386)
34# define __STRERROR_NAME "_strerror$UNIX2003"
Tim Northover4cfed272014-10-08 17:28:37 +000035# elif defined(__x86_64__) || defined(__arm) || defined(__arm64)
Bill Wendlingda8596b2013-06-27 21:17:24 +000036# define __STRERROR_NAME "_strerror"
37# else
Stephen Hines2d1fdb22014-05-28 23:58:16 -070038# error "unrecognized architecture for targeting OS X"
Bill Wendlingda8596b2013-06-27 21:17:24 +000039# endif
40#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
Tim Northover4cfed272014-10-08 17:28:37 +000041# if defined(__i386) || defined (__x86_64) || defined(__arm) || defined(__arm64)
Bill Wendlingda8596b2013-06-27 21:17:24 +000042# define __STRERROR_NAME "_strerror"
43# else
Stephen Hines2d1fdb22014-05-28 23:58:16 -070044# error "unrecognized architecture for targeting iOS"
Bill Wendlingda8596b2013-06-27 21:17:24 +000045# endif
46#else
Stephen Hines2d1fdb22014-05-28 23:58:16 -070047# error "unrecognized architecture for targeting Darwin"
Bill Wendlingda8596b2013-06-27 21:17:24 +000048#endif
49
50char *strerror(int) __asm(__STRERROR_NAME);
51
Daniel Dunbar67588922011-11-16 22:40:57 +000052#endif /* __STRING_H__ */