git: 3c01fdcfc161 - stable/13 - cross-build: fix some redeclaration warnings during bootstrap

From: Alex Richardson <arichardson_at_FreeBSD.org>
Date: Sat, 07 May 2022 15:57:18 UTC
The branch stable/13 has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c01fdcfc161b06732b0762e37d1beca4a1f214d

commit 3c01fdcfc161b06732b0762e37d1beca4a1f214d
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-09-13 09:11:47 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2022-05-07 12:09:56 +0000

    cross-build: fix some redeclaration warnings during bootstrap
    
    MFC after:      3 days
    
    (cherry picked from commit a89410ef91798859f3fd7a5f675184b4d711ade4)
---
 tools/build/cross-build/include/linux/stdio.h     | 8 ++++++--
 tools/build/cross-build/include/linux/stdlib.h    | 2 --
 tools/build/cross-build/include/linux/sys/param.h | 3 ---
 tools/build/cross-build/include/linux/unistd.h    | 4 ----
 tools/build/cross-build/include/mac/stdlib.h      | 2 --
 5 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/tools/build/cross-build/include/linux/stdio.h b/tools/build/cross-build/include/linux/stdio.h
index 340977c15d93..c5aa893b320c 100644
--- a/tools/build/cross-build/include/linux/stdio.h
+++ b/tools/build/cross-build/include/linux/stdio.h
@@ -37,13 +37,17 @@
  */
 
 /* No #pragam once since glibc can include this multiple times */
-#include <sys/cdefs.h>
-
 #include_next <stdio.h>
 
+#ifndef _BOOTSTRAP_LINUX_STDIO_H
+#define _BOOTSTRAP_LINUX_STDIO_H
+#include <sys/cdefs.h>
+
 __BEGIN_DECLS
 char *fgetln(FILE *, __SIZE_TYPE__ *);
 #if defined(_WCHAR_H)
 __WCHAR_TYPE__ *fgetwln(FILE *__restrict, __SIZE_TYPE__ *__restrict);
 #endif
 __END_DECLS
+
+#endif
diff --git a/tools/build/cross-build/include/linux/stdlib.h b/tools/build/cross-build/include/linux/stdlib.h
index 9e0c1de02ccb..1e559ce1158c 100644
--- a/tools/build/cross-build/include/linux/stdlib.h
+++ b/tools/build/cross-build/include/linux/stdlib.h
@@ -60,8 +60,6 @@ int cgetustr(char *, const char *, char **);
 const char *getprogname(void);
 void setprogname(const char *progname);
 
-void *reallocarray(void *, size_t, size_t) __result_use_check
-    __alloc_size2(2, 3);
 void *reallocf(void *, size_t) __result_use_check __alloc_size(2);
 
 unsigned arc4random(void);
diff --git a/tools/build/cross-build/include/linux/sys/param.h b/tools/build/cross-build/include/linux/sys/param.h
index c918998e06a3..305d2767ae7e 100644
--- a/tools/build/cross-build/include/linux/sys/param.h
+++ b/tools/build/cross-build/include/linux/sys/param.h
@@ -47,6 +47,3 @@
  * let's use 32 since that will work across all systems
  */
 #define MAXLOGNAME 33 /* max login name length (incl. NUL) */
-
-/* For elftoolchain (seems like on ubuntu it's in errno.h) */
-extern char *program_invocation_short_name;
diff --git a/tools/build/cross-build/include/linux/unistd.h b/tools/build/cross-build/include/linux/unistd.h
index 9d1bd1bf4025..cd0b28ba39ed 100644
--- a/tools/build/cross-build/include/linux/unistd.h
+++ b/tools/build/cross-build/include/linux/unistd.h
@@ -77,10 +77,6 @@ getentropy(void *buf, size_t buflen)
 }
 #endif
 
-/* Used by elftoolchain: */
-extern char *program_invocation_name;
-extern char *program_invocation_short_name;
-
 void *setmode(const char *);
 mode_t getmode(const void *, mode_t);
 
diff --git a/tools/build/cross-build/include/mac/stdlib.h b/tools/build/cross-build/include/mac/stdlib.h
index fd9ba7fe6660..314ae0d1dca6 100644
--- a/tools/build/cross-build/include/mac/stdlib.h
+++ b/tools/build/cross-build/include/mac/stdlib.h
@@ -45,6 +45,4 @@ int rpmatch(const char *response);
 long long strtonum(const char *numstr, long long minval, long long maxval,
     const char **errstrp);
 
-void *reallocarray(void *optr, size_t nmemb, size_t size);
-
 __END_DECLS