bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 2/2] unlocked-io: do not redefine getc_unlocked etc.
Date: Mon,  1 Mar 2021 00:29:22 -0800	[thread overview]
Message-ID: <20210301082922.1121342-2-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20210301082922.1121342-1-eggert@cs.ucla.edu>

I ran into this problem on AIX 7.1 with GNU Tar, which
enables visibility of getc_unlocked etc. after testing
whether they’re declared, causing argp-namefrob.h and
unlocked-io.h to redefine the macros.
* lib/argp-namefrob.h, lib/unlocked-io.h:
(clearerr_unlocked, feof_unlocked ferror_unlocked)
(fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
(fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
(putc_unlocked, putchar_unlocked): Do not define if already defined.
---
 ChangeLog           | 11 +++++++++++
 lib/argp-namefrob.h | 41 +++++++++++++++++++++++++++--------------
 lib/unlocked-io.h   | 26 +++++++++++++-------------
 3 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f4bf4fced..c13c6816d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2021-03-01  Paul Eggert  <eggert@cs.ucla.edu>
 
+	unlocked-io: do not redefine getc_unlocked etc.
+	I ran into this problem on AIX 7.1 with GNU Tar, which
+	enables visibility of getc_unlocked etc. after testing
+	whether they’re declared, causing argp-namefrob.h and
+	unlocked-io.h to redefine the macros.
+	* lib/argp-namefrob.h, lib/unlocked-io.h:
+	(clearerr_unlocked, feof_unlocked ferror_unlocked)
+	(fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
+	(fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
+	(putc_unlocked, putchar_unlocked): Do not define if already defined.
+
 	parse-datetime2: new module
 	This splits the old parse-datetime into two parts; the
 	first is parse-datetime2 which supports all the new bells
diff --git a/lib/argp-namefrob.h b/lib/argp-namefrob.h
index f3216d7dd..de1a26e2a 100644
--- a/lib/argp-namefrob.h
+++ b/lib/argp-namefrob.h
@@ -95,43 +95,56 @@
 #undef __vsnprintf
 #define __vsnprintf vsnprintf
 
-#if defined(HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
+#if (defined HAVE_DECL_CLEARERR_UNLOCKED  && !HAVE_DECL_CLEARERR_UNLOCKED \
+     && !defined clearerr_unlocked)
 # define clearerr_unlocked(x) clearerr (x)
 #endif
-#if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
+#if (defined HAVE_DECL_FEOF_UNLOCKED && !HAVE_DECL_FEOF_UNLOCKED \
+     && !defined feof_unlocked)
 # define feof_unlocked(x) feof (x)
 #endif
-#if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
+#if (defined HAVE_DECL_FERROR_UNLOCKED && !HAVE_DECL_FERROR_UNLOCKED \
+     && !defined ferror_unlocked)
 # define ferror_unlocked(x) ferror (x)
 #endif
-#if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
+#if (defined HAVE_DECL_FFLUSH_UNLOCKED && !HAVE_DECL_FFLUSH_UNLOCKED \
+     && !defined fflush_unlocked)
 # define fflush_unlocked(x) fflush (x)
 #endif
-#if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
+#if (defined HAVE_DECL_FGETS_UNLOCKED && !HAVE_DECL_FGETS_UNLOCKED \
+     && !defined fgets_unlocked)
 # define fgets_unlocked(x,y,z) fgets (x,y,z)
 #endif
-#if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
+#if (defined HAVE_DECL_FPUTC_UNLOCKED && !HAVE_DECL_FPUTC_UNLOCKED \
+     && !defined fputc_unlocked)
 # define fputc_unlocked(x,y) fputc (x,y)
 #endif
-#if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
+#if (defined HAVE_DECL_FPUTS_UNLOCKED && !HAVE_DECL_FPUTS_UNLOCKED \
+     && !defined fputs_unlocked)
 # define fputs_unlocked(x,y) fputs (x,y)
 #endif
-#if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
+#if (defined HAVE_DECL_FREAD_UNLOCKED && !HAVE_DECL_FREAD_UNLOCKED \
+     && !defined fread_unlocked)
 # define fread_unlocked(w,x,y,z) fread (w,x,y,z)
 #endif
-#if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
+#if (defined HAVE_DECL_FWRITE_UNLOCKED && !HAVE_DECL_FWRITE_UNLOCKED \
+     && !defined fwrite_unlocked)
 # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
 #endif
-#if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
+#if (defined HAVE_DECL_GETC_UNLOCKED && !HAVE_DECL_GETC_UNLOCKED \
+     && !defined getc_unlocked)
 # define getc_unlocked(x) getc (x)
 #endif
-#if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
-#  define getchar_unlocked() getchar ()
+#if (defined HAVE_DECL_GETCHAR_UNLOCKED && !HAVE_DECL_GETCHAR_UNLOCKED \
+     && !defined getchar_unlocked)
+# define getchar_unlocked() getchar ()
 #endif
-#if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
+#if (defined HAVE_DECL_PUTC_UNLOCKED && !HAVE_DECL_PUTC_UNLOCKED \
+     && !defined putc_unlocked)
 # define putc_unlocked(x,y) putc (x,y)
 #endif
-#if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
+#if (defined HAVE_DECL_PUTCHAR_UNLOCKED && !HAVE_DECL_PUTCHAR_UNLOCKED \
+     && !defined putchar_unlocked)
 # define putchar_unlocked(x) putchar (x)
 #endif
 
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index 86b91c19d..ca184b31f 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -33,91 +33,91 @@
 
 # include <stdio.h>
 
-# if HAVE_DECL_CLEARERR_UNLOCKED
+# if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked
 #  undef clearerr
 #  define clearerr(x) clearerr_unlocked (x)
 # else
 #  define clearerr_unlocked(x) clearerr (x)
 # endif
 
-# if HAVE_DECL_FEOF_UNLOCKED
+# if HAVE_DECL_FEOF_UNLOCKED || defined feof_unlocked
 #  undef feof
 #  define feof(x) feof_unlocked (x)
 # else
 #  define feof_unlocked(x) feof (x)
 # endif
 
-# if HAVE_DECL_FERROR_UNLOCKED
+# if HAVE_DECL_FERROR_UNLOCKED || defined ferror_unlocked
 #  undef ferror
 #  define ferror(x) ferror_unlocked (x)
 # else
 #  define ferror_unlocked(x) ferror (x)
 # endif
 
-# if HAVE_DECL_FFLUSH_UNLOCKED
+# if HAVE_DECL_FFLUSH_UNLOCKED || defined fflush_unlocked
 #  undef fflush
 #  define fflush(x) fflush_unlocked (x)
 # else
 #  define fflush_unlocked(x) fflush (x)
 # endif
 
-# if HAVE_DECL_FGETS_UNLOCKED
+# if HAVE_DECL_FGETS_UNLOCKED || defined fgets_unlocked
 #  undef fgets
 #  define fgets(x,y,z) fgets_unlocked (x,y,z)
 # else
 #  define fgets_unlocked(x,y,z) fgets (x,y,z)
 # endif
 
-# if HAVE_DECL_FPUTC_UNLOCKED
+# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked
 #  undef fputc
 #  define fputc(x,y) fputc_unlocked (x,y)
 # else
 #  define fputc_unlocked(x,y) fputc (x,y)
 # endif
 
-# if HAVE_DECL_FPUTS_UNLOCKED
+# if HAVE_DECL_FPUTS_UNLOCKED || defined fputs_unlocked
 #  undef fputs
 #  define fputs(x,y) fputs_unlocked (x,y)
 # else
 #  define fputs_unlocked(x,y) fputs (x,y)
 # endif
 
-# if HAVE_DECL_FREAD_UNLOCKED
+# if HAVE_DECL_FREAD_UNLOCKED || defined fread_unlocked
 #  undef fread
 #  define fread(w,x,y,z) fread_unlocked (w,x,y,z)
 # else
 #  define fread_unlocked(w,x,y,z) fread (w,x,y,z)
 # endif
 
-# if HAVE_DECL_FWRITE_UNLOCKED
+# if HAVE_DECL_FWRITE_UNLOCKED || defined fwrite_unlocked
 #  undef fwrite
 #  define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
 # else
 #  define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
 # endif
 
-# if HAVE_DECL_GETC_UNLOCKED
+# if HAVE_DECL_GETC_UNLOCKED || defined get_unlocked
 #  undef getc
 #  define getc(x) getc_unlocked (x)
 # else
 #  define getc_unlocked(x) getc (x)
 # endif
 
-# if HAVE_DECL_GETCHAR_UNLOCKED
+# if HAVE_DECL_GETCHAR_UNLOCKED || defined getchar_unlocked
 #  undef getchar
 #  define getchar() getchar_unlocked ()
 # else
 #  define getchar_unlocked() getchar ()
 # endif
 
-# if HAVE_DECL_PUTC_UNLOCKED
+# if HAVE_DECL_PUTC_UNLOCKED || defined putc_unlocked
 #  undef putc
 #  define putc(x,y) putc_unlocked (x,y)
 # else
 #  define putc_unlocked(x,y) putc (x,y)
 # endif
 
-# if HAVE_DECL_PUTCHAR_UNLOCKED
+# if HAVE_DECL_PUTCHAR_UNLOCKED || defined putchar_unlocked
 #  undef putchar
 #  define putchar(x) putchar_unlocked (x)
 # else
-- 
2.29.2



  reply	other threads:[~2021-03-01  8:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  8:29 [PATCH 1/2] parse-datetime2: new module Paul Eggert
2021-03-01  8:29 ` Paul Eggert [this message]
2021-03-03  3:25 ` Bruno Haible
2021-03-06 16:26   ` Paul Eggert
2021-03-06 17:54     ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210301082922.1121342-2-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).