diff mbox series

Fix extra parens in config/tls.m4

Message ID 20180903235105.GA6698@SDF.ORG
State New
Headers show
Series Fix extra parens in config/tls.m4 | expand

Commit Message

Maya Rashish Sept. 3, 2018, 11:51 p.m. UTC
Hi folks,
This typo meant that HAVE_CC_TLS wasn't added to confdefs.h.

We run a potentially questionable setup where we save the results of
running configure for every architecture and then use it in subsequent
builds for reliability.

the addition of -DHAVE_CC_TLS wasn't saved to confdefs, so that's how
we got a bug: https://gnats.netbsd.org/53567

I don't know if anyone else runs a similar setup, but it is a cleanup
and an overall improvement to the code, nevertheless.

Maya Rashish <coypu@sdf.org>

config/tls.m4: Remove extra parentheses
libgcc/configure.ac: Remove unnecessary logic for set_have_cc_tls
	set_use_emutls, provided in confdefs.h
libgcc/configure: Regen
libgcc/Makefile.in: Remove extra logic for @set_have_cc_tls@
	@set_use_emutls@, now provided by confdefs.h

Comments

Maya Rashish Sept. 16, 2018, 9:57 a.m. UTC | #1
ping.
I can provide a less scary patch to correct the typo if people are
afraid of the cleanup changes.
Andreas Schwab Sept. 16, 2018, 11 a.m. UTC | #2
On Sep 03 2018, coypu@sdf.org wrote:

> config/tls.m4: Remove extra parentheses

There are no extra parentheses.

Andreas.
Maya Rashish Sept. 16, 2018, 11:36 a.m. UTC | #3
On Sun, Sep 16, 2018 at 01:00:21PM +0200, Andreas Schwab wrote:
> On Sep 03 2018, coypu@sdf.org wrote:
> 
> > config/tls.m4: Remove extra parentheses
> 
> There are no extra parentheses.
> 

For the benefit of the discussion, I've added the more minimal version
of the patch.

This is a weird configure test because of the parens. It's not wrong
because its wrongness is compensated for later. So maybe it's a matter
of opinion.

But probably this is the intended generated autoconf output.
diff --git a/config/tls.m4 b/config/tls.m4
index 4e170c8d6ae..b9b363d8a80 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -104,7 +104,7 @@ AC_DEFUN([GCC_CHECK_CC_TLS], [
 		 gcc_cv_have_cc_tls, [
     AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
       [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
-    )])
+    )
   if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
     AC_DEFINE(HAVE_CC_TLS, 1,
 	      [Define to 1 if the target assembler supports thread-local storage.])
diff --git a/libgcc/configure b/libgcc/configure
index 79068536175..8ccb700da0f 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5304,6 +5304,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_cc_tls" >&5
 $as_echo "$gcc_cv_have_cc_tls" >&6; }
+  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_CC_TLS 1" >>confdefs.h
+
+  fi
 set_have_cc_tls=
 if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
   set_have_cc_tls="-DHAVE_CC_TLS"
diff mbox series

Patch

diff --git a/config/tls.m4 b/config/tls.m4
index 4e170c8d6ae..b9b363d8a80 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -104,7 +104,7 @@  AC_DEFUN([GCC_CHECK_CC_TLS], [
 		 gcc_cv_have_cc_tls, [
     AC_COMPILE_IFELSE([__thread int a; int b; int main() { return a = b; }],
       [gcc_cv_have_cc_tls=yes], [gcc_cv_have_cc_tls=no])]
-    )])
+    )
   if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
     AC_DEFINE(HAVE_CC_TLS, 1,
 	      [Define to 1 if the target assembler supports thread-local storage.])
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 0c5b264f717..84738e76eaa 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -291,7 +291,7 @@  override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
 # will usually contain -g, so for the moment CFLAGS goes first.  We must
 # include CFLAGS - that's where multilib options live.
 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
-		  $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
+		  $(INCLUDES)
 
 # Options to use when compiling crtbegin/end.
 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
diff --git a/libgcc/configure b/libgcc/configure
index 090e5484131..f71afa3de01 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -567,8 +567,6 @@  tm_defines
 tm_file
 tmake_file
 sfp_machine_header
-set_use_emutls
-set_have_cc_tls
 vis_hide
 real_host_noncanonical
 accel_dir_suffix
@@ -5304,11 +5302,11 @@  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_have_cc_tls" >&5
 $as_echo "$gcc_cv_have_cc_tls" >&6; }
-set_have_cc_tls=
-if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
-  set_have_cc_tls="-DHAVE_CC_TLS"
-fi
+  if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
+
+$as_echo "#define HAVE_CC_TLS 1" >>confdefs.h
 
+  fi
 
 # See if we have emulated thread-local storage.
 
@@ -5340,11 +5338,6 @@  $as_echo "$gcc_cv_use_emutls" >&6; }
 $as_echo "#define USE_EMUTLS 1" >>confdefs.h
 
   fi
-set_use_emutls=
-if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
-  set_use_emutls="-DUSE_EMUTLS"
-fi
-
 
 
 
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 9d0bbcaba86..91fcb321010 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -519,19 +519,9 @@  fi
 # gcc, which can't be used to build executable due to that libgcc
 # is yet to be built here.
 GCC_CHECK_CC_TLS
-set_have_cc_tls=
-if test "$enable_tls $gcc_cv_have_cc_tls" = "yes yes"; then
-  set_have_cc_tls="-DHAVE_CC_TLS"
-fi
-AC_SUBST(set_have_cc_tls)
 
 # See if we have emulated thread-local storage.
 GCC_CHECK_EMUTLS
-set_use_emutls=
-if test "$enable_tls $gcc_cv_use_emutls" = "yes yes"; then
-  set_use_emutls="-DUSE_EMUTLS"
-fi
-AC_SUBST(set_use_emutls)
 
 dnl Check if as supports AVX instructions.
 AC_DEFUN([LIBGCC_CHECK_AS_AVX], [