commit 5e272147e5f920971616f76d5cd41e8a3780a353
parent ed368eb12822027ed7c15bcfdf4eae457373ca33
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 4 Mar 2017 08:01:44 +0100
[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.
Diffstat:
29 files changed, 29 insertions(+), 0 deletions(-)
diff --git 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);
diff --git 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)
diff --git 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 */
diff --git 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);
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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;
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)
diff --git 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)