shithub: scc

Download patch

ref: 51ab7caf2cfe53f509d758b154ad01f315da1ce2
parent: 54374eb1baef2600d9fd2aabd08f71a16d50a392
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Mar 4 03:01:44 EST 2017

[libc] Undef all the libc symbols before the implementation

Any function of the library can be implemented using a
macro, so in the implementation file is a good idea to
undef the name of the function to avoid problems.

--- a/libc/src/atexit.c
+++ b/libc/src/atexit.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <stdlib.h>
+#undef atexit
 
 extern void (*_atexitf[_ATEXIT_MAX])(void);
 
--- a/libc/src/atoi.c
+++ b/libc/src/atoi.c
@@ -2,6 +2,7 @@
 
 #include <ctype.h>
 #include <stdlib.h>
+#undef atoi
 
 int
 atoi(const char *s)
--- a/libc/src/ctype.c
+++ b/libc/src/ctype.c
@@ -2,6 +2,7 @@
 
 #define __USE_MACROS
 #include <ctype.h>
+#undef ctype
 
 unsigned char _ctype[255] = {
 	_C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */
--- a/libc/src/exit.c
+++ b/libc/src/exit.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <stdlib.h>
+#undef exit
 
 void (*_atexitf[_ATEXIT_MAX])(void);
 
--- a/libc/src/localeconv.c
+++ b/libc/src/localeconv.c
@@ -1,5 +1,6 @@
 #include <locale.h>
 #include <limits.h>
+#undef localeconv
 
 struct lconv *
 localeconv(void)
--- a/libc/src/memchr.c
+++ b/libc/src/memchr.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef memchr
 
 void *
 memchr(const void *s, int c, size_t n)
--- a/libc/src/memcmp.c
+++ b/libc/src/memcmp.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef memcmp
 
 int
 memcmp(const void *s1, const void *s2, size_t n)
--- a/libc/src/memcpy.c
+++ b/libc/src/memcpy.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef memcpy
 
 void *
 memcpy(void * restrict dst, const void * restrict src, size_t n)
--- a/libc/src/memmove.c
+++ b/libc/src/memmove.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef memmove
 
 void *
 memmove(void *dst, const void *src, size_t n)
--- a/libc/src/memset.c
+++ b/libc/src/memset.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef memset
 
 void *
 memset(void *s, int c, size_t n)
--- a/libc/src/rand.c
+++ b/libc/src/rand.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <stdlib.h>
+#undef rand
 
 static int next;
 
--- a/libc/src/setlocale.c
+++ b/libc/src/setlocale.c
@@ -2,6 +2,7 @@
 
 #include <locale.h>
 #include <stddef.h>
+#undef setlocale
 
 char *
 setlocale(int category, const char *locale)
--- a/libc/src/strcat.c
+++ b/libc/src/strcat.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strcat
 
 char *
 strcat(char * restrict dst, const char * restrict src)
--- a/libc/src/strchr.c
+++ b/libc/src/strchr.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strchr
 
 char *
 strchr(const char *s, int c)
--- a/libc/src/strcmp.c
+++ b/libc/src/strcmp.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strcmp
 
 int
 strcmp(const char *s1, const char *s2)
--- a/libc/src/strcoll.c
+++ b/libc/src/strcoll.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strcoll
 
 int
 strcoll(const char *s1, const char *s2)
--- a/libc/src/strcpy.c
+++ b/libc/src/strcpy.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strcpy
 
 char *
 strcpy(char * restrict dst, const char * restrict src)
--- a/libc/src/strcspn.c
+++ b/libc/src/strcspn.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strcspn
 
 size_t
 strcspn(const char *s1, const char *s2)
--- a/libc/src/strlen.c
+++ b/libc/src/strlen.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strlen
 
 size_t
 strlen(const char *s)
--- a/libc/src/strncat.c
+++ b/libc/src/strncat.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strncat
 
 char *
 strncat(char * restrict dst, const char * restrict src, size_t n)
--- a/libc/src/strncmp.c
+++ b/libc/src/strncmp.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strncmp
 
 int
 strncmp(const char *s1, const char *s2, size_t n)
--- a/libc/src/strncpy.c
+++ b/libc/src/strncpy.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strncpy
 
 char *
 strncpy(char * restrict dst, const char * restrict src, size_t n)
--- a/libc/src/strpbrk.c
+++ b/libc/src/strpbrk.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strpbrk
 
 char *
 strpbrk(const char *s1, const char *s2)
--- a/libc/src/strrchr.c
+++ b/libc/src/strrchr.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strrchr
 
 char *
 strrchr(const char *s, int c)
--- a/libc/src/strspn.c
+++ b/libc/src/strspn.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strspn
 
 size_t
 strspn(const char *s1, const char *s2)
--- a/libc/src/strstr.c
+++ b/libc/src/strstr.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strstr
 
 char *
 strstr(const char *s1, const char *s2)
--- a/libc/src/strtok.c
+++ b/libc/src/strtok.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strtok
 
 char *
 strtok(char * restrict s, const char * restrict delim)
--- a/libc/src/strxfrm.c
+++ b/libc/src/strxfrm.c
@@ -1,6 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 
 #include <string.h>
+#undef strxfrm
 
 size_t
 strxfrm(char * restrict dst, const char * restrict src, size_t n)
--- a/libc/src/tolower.c
+++ b/libc/src/tolower.c
@@ -2,6 +2,7 @@
 
 #define __USE_MACROS
 #include <ctype.h>
+#undef tolower
 
 int
 tolower(int c)