bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nap() name space clash


From: Bruno Haible
Subject: Re: nap() name space clash
Date: Sun, 11 Oct 2020 20:55:03 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

Hi Tim,

> I've prepared 2 patch options for your consideration.
> 
> The attached nap2gnulib_nap.patch renames nap to gnulib_nap and leaves
> the tests/nap.h name alone.
> 
> The attached nap2gnulib_nap_with_nap_h_rename.patch assumes a
> "git mv tests/nap.h tests/gnulib_nap.h"

It smells too much of a workaround. I would prefer
  (a) either a rename like in your second patch, with a symbol name
      that looks clean (e.g. 'short_sleep' instead of 'gnulib_nap'),
  (b) or a workaround that is limited in scope: few lines of code, and
      no effect on other platforms.

> > } > > In which .h file is this function declared on UnixWare?
> > } > 
> > } > unistd.h

Since the function defined by tests/nap.h is of storage class 'static',
there is no conflict at the linker level, and the conflict at the source
code level can be resolved by a simple '#define'.

So I'm picking the approach (b).


2020-10-11  Bruno Haible  <bruno@clisp.org>

        tests: Avoid a name clash on UnixWare.
        Reported by Tim Rice <tim@multitalents.net> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00025.html>.
        * tests/nap.h (nap): Define as gl_nap on OpenServer and UnixWare.

diff --git a/tests/nap.h b/tests/nap.h
index 5dd264f..c27e538 100644
--- a/tests/nap.h
+++ b/tests/nap.h
@@ -24,6 +24,13 @@
 
 # include <intprops.h>
 
+/* Avoid a conflict with a function called nap() on UnixWare.  */
+# if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__)  /* 
OpenServer, UnixWare */
+#  include <unistd.h>
+#  undef nap
+#  define nap gl_nap
+# endif
+
 /* Name of the witness file.  */
 #define TEMPFILE BASE "nap.tmp"
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]