bug-m4
[Top][All Lists]
Advanced

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

Enable more single-thread optimizations in gnulib code


From: Bruno Haible
Subject: Enable more single-thread optimizations in gnulib code
Date: Thu, 13 May 2021 11:25:41 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; )

On many systems (esp. BSD ones), building a recent m4 snapshot produces these
warnings:

--------------------------------------------------------------------------------
  CC       regex.o
In file included from ../../lib/regex_internal.h:57:0,
                 from ../../lib/regex.c:70:
../../lib/regcomp.c: In function 'rpl_regfree':
../../lib/glthread/lock.h:640:38: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_destroy(NAME) 0
                                      ^
../../lib/regex_internal.h:60:26: note: in expansion of macro 
'glthread_lock_destroy'
 # define lock_fini(lock) glthread_lock_destroy (&(lock))
                          ^
../../lib/regcomp.c:638:7: note: in expansion of macro 'lock_fini'
       lock_fini (dfa->lock);
       ^
../../lib/regcomp.c: In function 're_compile_internal':
../../lib/glthread/lock.h:640:38: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_destroy(NAME) 0
                                      ^
../../lib/regex_internal.h:60:26: note: in expansion of macro 
'glthread_lock_destroy'
 # define lock_fini(lock) glthread_lock_destroy (&(lock))
                          ^
../../lib/regcomp.c:781:7: note: in expansion of macro 'lock_fini'
       lock_fini (dfa->lock);
       ^
../../lib/glthread/lock.h:640:38: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_destroy(NAME) 0
                                      ^
../../lib/regex_internal.h:60:26: note: in expansion of macro 
'glthread_lock_destroy'
 # define lock_fini(lock) glthread_lock_destroy (&(lock))
                          ^
../../lib/regcomp.c:814:7: note: in expansion of macro 'lock_fini'
       lock_fini (dfa->lock);
       ^
../../lib/regexec.c: In function 'rpl_regexec':
../../lib/glthread/lock.h:638:35: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_lock(NAME) 0
                                   ^
../../lib/regex_internal.h:61:26: note: in expansion of macro 
'glthread_lock_lock'
 # define lock_lock(lock) glthread_lock_lock (&(lock))
                          ^
../../lib/regexec.c:214:3: note: in expansion of macro 'lock_lock'
   lock_lock (dfa->lock);
   ^
../../lib/glthread/lock.h:639:37: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_unlock(NAME) 0
                                     ^
../../lib/regex_internal.h:62:28: note: in expansion of macro 
'glthread_lock_unlock'
 # define lock_unlock(lock) glthread_lock_unlock (&(lock))
                            ^
../../lib/regexec.c:221:3: note: in expansion of macro 'lock_unlock'
   lock_unlock (dfa->lock);
   ^
In file included from ../../lib/regex.c:74:0:
../../lib/regexec.c:198:13: warning: unused variable 'dfa' [-Wunused-variable]
   re_dfa_t *dfa = preg->buffer;
             ^
In file included from ../../lib/regex_internal.h:57:0,
                 from ../../lib/regex.c:70:
../../lib/regexec.c: In function 're_search_stub':
../../lib/glthread/lock.h:638:35: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_lock(NAME) 0
                                   ^
../../lib/regex_internal.h:61:26: note: in expansion of macro 
'glthread_lock_lock'
 # define lock_lock(lock) glthread_lock_lock (&(lock))
                          ^
../../lib/regexec.c:391:3: note: in expansion of macro 'lock_lock'
   lock_lock (dfa->lock);
   ^
../../lib/glthread/lock.h:639:37: warning: statement with no effect 
[-Wunused-value]
 # define glthread_lock_unlock(NAME) 0
                                     ^
../../lib/regex_internal.h:62:28: note: in expansion of macro 
'glthread_lock_unlock'
 # define lock_unlock(lock) glthread_lock_unlock (&(lock))
                            ^
../../lib/regexec.c:455:3: note: in expansion of macro 'lock_unlock'
   lock_unlock (dfa->lock);
   ^
In file included from ../../lib/regex.c:74:0:
../../lib/regexec.c:378:13: warning: unused variable 'dfa' [-Wunused-variable]
   re_dfa_t *dfa = bufp->buffer;
             ^
--------------------------------------------------------------------------------

These warnings are indicating that the regex module is being built for multi-
threading, while at the same time the Gnulib 'lock' module is being optimized
for single-threading (due to the gl_DISABLE_THREADS invocation in configure.ac).

According to the Gnulib documentation section "Optimizations of multithreaded
code" several more optimizations can be enabled. This patch
  - enables these single-threading optimizations,
  - by doing so, gets rid of the warnings in regex.c,
  - causes no test failures.

OK to push?

Attachment: 0001-Enable-more-single-thread-optimizations-in-gnulib-co.patch
Description: Text Data


reply via email to

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