]> Savannah Git Hosting - gnulib.git/commitdiff
threads-h: Support several gnulib-tool invocations better.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Dec 2024 10:22:40 +0000 (11:22 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 25 Dec 2024 14:27:21 +0000 (15:27 +0100)
* lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
that depends on GUARD_PREFIX.
(struct thrd_with_exitcode): Avoid duplicate definition.

ChangeLog
lib/threads.in.h

index fcf94b367c8791c48f9493b6df02cd7050774a6b..e51329096c1a8e89ccb69284cb45188a3efb8f56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-12-24  Bruno Haible  <bruno@clisp.org>
+
+       threads-h: Support several gnulib-tool invocations better.
+       * lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
+       that depends on GUARD_PREFIX.
+       (struct thrd_with_exitcode): Avoid duplicate definition.
+
 2024-12-24  Bruno Haible  <bruno@clisp.org>
 
        sys_socket: Support several gnulib-tool invocations better.
index b4f5b65c63d147f72cf979d2835a22f8e3509346..a0ff2cb9511653d75df070303d0b25cd4abcde8f 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 @PRAGMA_COLUMNS@
 
-#if defined _GL_ALREADY_INCLUDING_THREADS_H
+#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 /* Special invocation convention:
    - On Android we have a sequence of nested includes
      <threads.h> -> <android/legacy_threads_inlines.h>
 
 #ifndef _@GUARD_PREFIX@_THREADS_H
 
-#define _GL_ALREADY_INCLUDING_THREADS_H
+#define _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 
 /* The include_next requires a split double-inclusion guard.  */
 #if @HAVE_THREADS_H@
 # @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_THREADS_H@
 #endif
 
-#undef _GL_ALREADY_INCLUDING_THREADS_H
+#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_THREADS_H
 
 #ifndef _@GUARD_PREFIX@_THREADS_H
 #define _@GUARD_PREFIX@_THREADS_H
@@ -144,6 +144,7 @@ typedef pthread_t thrd_t;
 #endif
 #if @BROKEN_THRD_START_T@ || @BROKEN_THRD_JOIN@
 /* Need to override thrd_t, to make thrd_join work.  */
+# if !defined GNULIB_defined_struct_thrd_with_exitcode
 struct thrd_with_exitcode
 {
   thrd_t volatile tid;
@@ -151,7 +152,9 @@ struct thrd_with_exitcode
   int volatile exitcode;
 };
 typedef struct thrd_with_exitcode *rpl_thrd_t;
-# define thrd_t rpl_thrd_t
+#  define thrd_t rpl_thrd_t
+#  define GNULIB_defined_struct_thrd_with_exitcode 1
+# endif
 #endif
 /* Type of the main function of a thread.  */
 #if !@HAVE_THREADS_H@ || @BROKEN_THRD_START_T@