Hi tech@,

Most (but not all) __warn_references occurences in libc are wrapped in
#if defined(APIWARN) blocks. This diff wraps the remaining occurences,
so building libc without the APIWARN definition does not produce any
strain .gnu.warning.* sections.

Comments? OK?

Index: lib/libc/compat-43/getwd.c
===================================================================
RCS file: /cvs/src/lib/libc/compat-43/getwd.c,v
retrieving revision 1.12
diff -u -p -r1.12 getwd.c
--- lib/libc/compat-43/getwd.c  28 Nov 2017 06:55:49 -0000      1.12
+++ lib/libc/compat-43/getwd.c  24 Oct 2021 22:07:40 -0000
@@ -45,5 +45,7 @@ getwd(char *buf)
        return(NULL);
 }
 
+#if defined(APIWARN)
 __warn_references(getwd,
     "getwd() possibly used unsafely; consider using getcwd()");
+#endif
Index: lib/libc/stdio/mktemp.c
===================================================================
RCS file: /cvs/src/lib/libc/stdio/mktemp.c,v
retrieving revision 1.39
diff -u -p -r1.39 mktemp.c
--- lib/libc/stdio/mktemp.c     28 Nov 2017 06:55:49 -0000      1.39
+++ lib/libc/stdio/mktemp.c     24 Oct 2021 22:07:41 -0000
@@ -118,8 +118,10 @@ _mktemp(char *path)
        return(path);
 }
 
+#if defined(APIWARN)
 __warn_references(mktemp,
     "mktemp() possibly used unsafely; consider using mkstemp()");
+#endif
 
 char *
 mktemp(char *path)
Index: lib/libc/stdio/tempnam.c
===================================================================
RCS file: /cvs/src/lib/libc/stdio/tempnam.c,v
retrieving revision 1.20
diff -u -p -r1.20 tempnam.c
--- lib/libc/stdio/tempnam.c    28 Nov 2017 06:55:49 -0000      1.20
+++ lib/libc/stdio/tempnam.c    24 Oct 2021 22:07:41 -0000
@@ -36,8 +36,10 @@
 #include <string.h>
 #include <unistd.h>
 
+#if defined(APIWARN)
 __warn_references(tempnam,
     "tempnam() possibly used unsafely; consider using mkstemp()");
+#endif
 
 char *
 tempnam(const char *dir, const char *pfx)
Index: lib/libc/stdio/tmpnam.c
===================================================================
RCS file: /cvs/src/lib/libc/stdio/tmpnam.c,v
retrieving revision 1.12
diff -u -p -r1.12 tmpnam.c
--- lib/libc/stdio/tmpnam.c     28 Nov 2017 06:55:49 -0000      1.12
+++ lib/libc/stdio/tmpnam.c     24 Oct 2021 22:07:41 -0000
@@ -36,8 +36,10 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#if defined(APIWARN)
 __warn_references(tmpnam,
     "tmpnam() possibly used unsafely; consider using mkstemp()");
+#endif
 
 char *
 tmpnam(char *s)

Reply via email to