[compiler-rt] r185105 - Declare 'strerror' so that we can use it with errno.

Bill Wendling isanbard at gmail.com
Thu Jun 27 14:17:24 PDT 2013


Author: void
Date: Thu Jun 27 16:17:24 2013
New Revision: 185105

URL: http://llvm.org/viewvc/llvm-project?rev=185105&view=rev
Log:
Declare 'strerror' so that we can use it with errno.

Modified:
    compiler-rt/trunk/SDKs/darwin/usr/include/string.h

Modified: compiler-rt/trunk/SDKs/darwin/usr/include/string.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/SDKs/darwin/usr/include/string.h?rev=185105&r1=185104&r2=185105&view=diff
==============================================================================
--- compiler-rt/trunk/SDKs/darwin/usr/include/string.h (original)
+++ compiler-rt/trunk/SDKs/darwin/usr/include/string.h Thu Jun 27 16:17:24 2013
@@ -28,4 +28,25 @@ char *strdup(const char *);
 size_t strlen(const char *);
 char *strncpy(char *, const char *, size_t);
 
+/* Determine the appropriate strerror() function. */
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#  if defined(__i386)
+#    define __STRERROR_NAME  "_strerror$UNIX2003"
+#  elif defined(__x86_64__) || defined(__arm)
+#    define __STRERROR_NAME  "_strerror"
+#  else
+#    error "unrecognized architecture for targetting OS X"
+#  endif
+#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
+#  if defined(__i386) || defined (__x86_64) || defined(__arm)
+#    define __STRERROR_NAME  "_strerror"
+#  else
+#    error "unrecognized architecture for targetting iOS"
+#  endif
+#else
+#  error "unrecognized architecture for targetting Darwin"
+#endif
+
+char *strerror(int) __asm(__STRERROR_NAME);
+
 #endif /* __STRING_H__ */





More information about the llvm-commits mailing list