bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'thread-optim'


From: Bruno Haible
Subject: Re: new module 'thread-optim'
Date: Wed, 12 Aug 2020 02:43:16 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

There was also another blunder in the same file: IF_MT_DECL produces
a warning:

$ gcc -O2 -S -Wall foo.c
foo.c: In function ‘foo’:
foo.c:2:3: warning: statement with no effect [-Wunused-value]
   (void *)0;
   ^

$ clang -O2 -S -Wall foo.c
foo.c:2:3: warning: expression result unused; should this cast be to 'void'? 
[-Wunused-value]
  (void *)0;
  ^     ~

I start to appreciate clang's warnings :-)


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

        thread-optim: Fix a compiler warning.
        * lib/thread-optim.h (IF_MT_DECL): Define differently.

diff --git a/lib/thread-optim.h b/lib/thread-optim.h
index 5d9a499..0cdcfec 100644
--- a/lib/thread-optim.h
+++ b/lib/thread-optim.h
@@ -53,7 +53,7 @@
 # define IF_MT_DECL  char optimize_for_single_thread = __libc_single_threaded
 # define IF_MT       if (!optimize_for_single_thread)
 #else
-# define IF_MT_DECL  (void *)0
+# define IF_MT_DECL  (void)0
 # define IF_MT
 #endif
 




reply via email to

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