public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] configure: add --disable-fix-includes
@ 2022-05-09  9:03 Martin Liška
  2022-05-09  9:31 ` Andreas Schwab
  2022-05-09 21:14 ` Joseph Myers
  0 siblings, 2 replies; 18+ messages in thread
From: Martin Liška @ 2022-05-09  9:03 UTC (permalink / raw)
  To: gcc-patches

Right now, fixinclude takes about 11 seconds on my machine, where
it reads 130MB of header files.

The number of fixed headers is negligible without any significant
change.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

fixincludes/ChangeLog:

	* fixinc.in: Add early exit.

gcc/ChangeLog:

	* Makefile.in: Support disable_fix_includes.
	* configure.ac: Add --disable-fix-includes.
	* configure: Regenerate.
---
 fixincludes/fixinc.in |  6 ++++++
 gcc/Makefile.in       |  6 ++++--
 gcc/configure         | 21 +++++++++++++++++++--
 gcc/configure.ac      |  6 ++++++
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index 0c3066452c6..3ebcd346d41 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -63,6 +63,12 @@ else
   esac
 fi
 
+if test "x$DISABLE_FIX_INCLUDES" = "xyes"
+then
+  echo "Skipping fixincludes"
+  exit 0
+fi
+
 # Define what target system we're fixing.
 #
 if test -r ./Makefile; then
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 31ff95500c9..c77f1cc644d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -401,6 +401,8 @@ PLUGINLIBS = @pluginlibs@
 
 enable_plugin = @enable_plugin@
 
+disable_fix_includes = @disable_fix_includes@
+
 # On MinGW plugin installation involves installing import libraries.
 ifeq ($(enable_plugin),yes)
   plugin_implib := $(if $(strip $(filter mingw%,$(host_os))),yes,no)
@@ -3248,8 +3250,8 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	    chmod a+rx $${fix_dir} || true; \
 	    (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
 	      SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
-	      gcc_dir=`${PWD_COMMAND}` ; \
-	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
+	      gcc_dir=`${PWD_COMMAND}` ; DISABLE_FIX_INCLUDES=${disable_fix_includes} \
+	      export TARGET_MACHINE srcdir SHELL MACRO_LIST DISABLE_FIX_INCLUDES && \
 	      cd $(build_objdir)/fixincludes && \
 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
 	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..843ab02bfa3 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -839,6 +839,7 @@ with_float
 with_cpu
 enable_multiarch
 enable_multilib
+disable_fix_includes
 coverage_flags
 valgrind_command
 valgrind_path_defines
@@ -958,6 +959,7 @@ enable_werror_always
 enable_checking
 enable_coverage
 enable_gather_detailed_mem_stats
+enable_disable_fix_includes
 enable_valgrind_annotations
 enable_multilib
 enable_multiarch
@@ -1688,6 +1690,7 @@ Optional Features:
                           Values are opt, noopt, default is noopt
   --enable-gather-detailed-mem-stats
                           enable detailed memory allocation stats gathering
+  --disable-fix-includes  skip fixing of includes
   --enable-valgrind-annotations
                           enable valgrind runtime interaction
   --enable-multilib       enable library support for multiple ABIs
@@ -7780,6 +7783,20 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check whether --enable-disable-fix-includes was given.
+if test "${enable_disable_fix_includes+set}" = set; then :
+  enableval=$enable_disable_fix_includes;
+else
+  disable_fix_includes=yes
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define FIX_INCLUDES $disable_fix_includes
+_ACEOF
+
+
+
 # Check whether --enable-valgrind-annotations was given.
 if test "${enable_valgrind_annotations+set}" = set; then :
   enableval=$enable_valgrind_annotations;
@@ -19659,7 +19676,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19662 "configure"
+#line 19679 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19765,7 +19782,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19768 "configure"
+#line 19785 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..6015e403aa9 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -842,6 +842,12 @@ gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else
 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
 [Define to enable detailed memory allocation stats gathering.])
 
+AC_ARG_ENABLE(disable-fix-includes,
+[AS_HELP_STRING([--disable-fix-includes],
+		[skip fixing of includes])], [],
+[disable_fix_includes=yes])
+AC_SUBST(disable_fix_includes)
+
 AC_ARG_ENABLE(valgrind-annotations,
 [AS_HELP_STRING([--enable-valgrind-annotations],
 		[enable valgrind runtime interaction])], [],
-- 
2.36.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-09  9:03 [PATCH] configure: add --disable-fix-includes Martin Liška
@ 2022-05-09  9:31 ` Andreas Schwab
  2022-05-09 21:14 ` Joseph Myers
  1 sibling, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2022-05-09  9:31 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Mai 09 2022, Martin Liška wrote:

> +cat >>confdefs.h <<_ACEOF
> +#define FIX_INCLUDES $disable_fix_includes
> +_ACEOF

Where does this come from?  Also, nothing uses it.

> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index 1171c946e6e..6015e403aa9 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -842,6 +842,12 @@ gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else
>  AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
>  [Define to enable detailed memory allocation stats gathering.])
>  
> +AC_ARG_ENABLE(disable-fix-includes,
> +[AS_HELP_STRING([--disable-fix-includes],
> +		[skip fixing of includes])], [],
> +[disable_fix_includes=yes])

That creates the (non-working) options --enable-disable-fix-includes and
--disable-disable-fix-includes, but not --disable-fix-includes.  It also
disables fixincludes by default, which doesn't look intended.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-09  9:03 [PATCH] configure: add --disable-fix-includes Martin Liška
  2022-05-09  9:31 ` Andreas Schwab
@ 2022-05-09 21:14 ` Joseph Myers
  2022-05-11 10:55   ` Martin Liška
  1 sibling, 1 reply; 18+ messages in thread
From: Joseph Myers @ 2022-05-09 21:14 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

If you add a new configure option, it should be documented in 
install.texi.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-09 21:14 ` Joseph Myers
@ 2022-05-11 10:55   ` Martin Liška
  2022-05-11 11:00     ` Rainer Orth
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-05-11 10:55 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

On 5/9/22 23:14, Joseph Myers wrote:
> If you add a new configure option, it should be documented in 
> install.texi.
> 

Both comments fixed in the v2.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-configure-add-disable-fix-includes.patch --]
[-- Type: text/x-patch, Size: 5562 bytes --]

From 58d431568d6b6163dd9cdc920239f173689a769c Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 4 Feb 2022 13:42:14 +0100
Subject: [PATCH] configure: add --disable-fix-includes

Right now, fixinclude takes about 11 seconds on my machine, where
it reads 130MB of header files.

The number of fixed headers is negligible without any significant
change.

fixincludes/ChangeLog:

	* fixinc.in: Add early exit.

gcc/ChangeLog:

	* Makefile.in: Support disable_fix_includes.
	* configure.ac: Add --disable-fix-includes.
	* configure: Regenerate.
	* doc/install.texi: Document the newly added configure options.
---
 fixincludes/fixinc.in |  6 ++++++
 gcc/Makefile.in       |  6 ++++--
 gcc/configure         | 16 ++++++++++++++--
 gcc/configure.ac      |  6 ++++++
 gcc/doc/install.texi  |  7 +++++++
 5 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index 0bd8027a554..9baec3f871d 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -63,6 +63,12 @@ else
   esac
 fi
 
+if test "x$ENABLE_FIX_INCLUDES" = "xno"
+then
+  echo "Skipping fixincludes"
+  exit 0
+fi
+
 # Define what target system we're fixing.
 #
 if test -r ./Makefile; then
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 31ff95500c9..80de547231a 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -401,6 +401,8 @@ PLUGINLIBS = @pluginlibs@
 
 enable_plugin = @enable_plugin@
 
+enable_fix_includes = @enable_fix_includes@
+
 # On MinGW plugin installation involves installing import libraries.
 ifeq ($(enable_plugin),yes)
   plugin_implib := $(if $(strip $(filter mingw%,$(host_os))),yes,no)
@@ -3248,8 +3250,8 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	    chmod a+rx $${fix_dir} || true; \
 	    (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
 	      SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
-	      gcc_dir=`${PWD_COMMAND}` ; \
-	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
+	      gcc_dir=`${PWD_COMMAND}` ; ENABLE_FIX_INCLUDES=${enable_fix_includes} \
+	      export TARGET_MACHINE srcdir SHELL MACRO_LIST ENABLE_FIX_INCLUDES && \
 	      cd $(build_objdir)/fixincludes && \
 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
 	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
diff --git a/gcc/configure b/gcc/configure
index 5ce0557719a..e29f2cf7d2e 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -839,6 +839,7 @@ with_float
 with_cpu
 enable_multiarch
 enable_multilib
+enable_fix_includes
 coverage_flags
 valgrind_command
 valgrind_path_defines
@@ -958,6 +959,7 @@ enable_werror_always
 enable_checking
 enable_coverage
 enable_gather_detailed_mem_stats
+enable_fix_includes
 enable_valgrind_annotations
 enable_multilib
 enable_multiarch
@@ -1688,6 +1690,7 @@ Optional Features:
                           Values are opt, noopt, default is noopt
   --enable-gather-detailed-mem-stats
                           enable detailed memory allocation stats gathering
+  --disable-fix-includes  skip fixing of includes
   --enable-valgrind-annotations
                           enable valgrind runtime interaction
   --enable-multilib       enable library support for multiple ABIs
@@ -7783,6 +7786,15 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check whether --enable-fix-includes was given.
+if test "${enable_fix_includes+set}" = set; then :
+  enableval=$enable_fix_includes;
+else
+  enable_fix_includes=yes
+fi
+
+
+
 # Check whether --enable-valgrind-annotations was given.
 if test "${enable_valgrind_annotations+set}" = set; then :
   enableval=$enable_valgrind_annotations;
@@ -19673,7 +19685,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19676 "configure"
+#line 19688 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19779,7 +19791,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19782 "configure"
+#line 19794 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23bee7010a3..0e20435d38b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -842,6 +842,12 @@ gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else
 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
 [Define to enable detailed memory allocation stats gathering.])
 
+AC_ARG_ENABLE(fix-includes,
+[AS_HELP_STRING([--disable-fix-includes],
+		[skip fixing of includes])], [],
+[enable_fix_includes=yes])
+AC_SUBST(enable_fix_includes)
+
 AC_ARG_ENABLE(valgrind-annotations,
 [AS_HELP_STRING([--enable-valgrind-annotations],
 		[enable valgrind runtime interaction])], [],
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 10bfceffceb..c1404b4947e 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2371,6 +2371,13 @@ For a native build and cross compiles that have target headers, the option's
 default is derived from glibc's behavior. When glibc clamps float_t to double,
 GCC follows and enables the option. For other cross compiles, the default is
 disabled.
+
+@item --enable-fix-include
+@itemx --disable-fix-include
+
+Enable fixing of system header files. GCC needs to install corrected versions
+of some system header files. This is because most target systems have
+some header files that won’t work with GCC unless they are changed.
 @end table
 
 @subheading Cross-Compiler-Specific Options
-- 
2.36.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 10:55   ` Martin Liška
@ 2022-05-11 11:00     ` Rainer Orth
  2022-05-11 11:15       ` Martin Liška
  0 siblings, 1 reply; 18+ messages in thread
From: Rainer Orth @ 2022-05-11 11:00 UTC (permalink / raw)
  To: Martin Liška; +Cc: Joseph Myers, gcc-patches

Hi Martin,

> On 5/9/22 23:14, Joseph Myers wrote:
>> If you add a new configure option, it should be documented in 
>> install.texi.
>> 
>
> Both comments fixed in the v2.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> From 58d431568d6b6163dd9cdc920239f173689a769c Mon Sep 17 00:00:00 2001
> From: Martin Liska <mliska@suse.cz>
> Date: Fri, 4 Feb 2022 13:42:14 +0100
> Subject: [PATCH] configure: add --disable-fix-includes

As I've mentioned before, I believe, the command is called fixincludes
in current gcc docs, and the option should reflect that, not introduce a
name used nowhere else.

> Right now, fixinclude takes about 11 seconds on my machine, where
> it reads 130MB of header files.
>
> The number of fixed headers is negligible without any significant
> change.

Please speak for Linux, but not for other targets ;-)

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 11:00     ` Rainer Orth
@ 2022-05-11 11:15       ` Martin Liška
  2022-05-11 11:31         ` Rainer Orth
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-05-11 11:15 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph Myers, gcc-patches

On 5/11/22 13:00, Rainer Orth wrote:
> Hi Martin,
> 
>> On 5/9/22 23:14, Joseph Myers wrote:
>>> If you add a new configure option, it should be documented in 
>>> install.texi.
>>>
>>
>> Both comments fixed in the v2.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>> From 58d431568d6b6163dd9cdc920239f173689a769c Mon Sep 17 00:00:00 2001
>> From: Martin Liska <mliska@suse.cz>
>> Date: Fri, 4 Feb 2022 13:42:14 +0100
>> Subject: [PATCH] configure: add --disable-fix-includes
> 
> As I've mentioned before, I believe, the command is called fixincludes
> in current gcc docs, and the option should reflect that, not introduce a
> name used nowhere else.

No, I can't use it, because even with current master using --disable-fixincludes
means the tool is not built at all. It results with:

g++   -g       -DIN_GCC -fPIC    -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H  -DGENERATOR_FILE -static-libstdc++ -static-libgcc   -o build/genchecksum \
    build/genchecksum.o ../build-x86_64-pc-linux-gnu/libiberty/pic/libiberty.a
make: *** No rule to make target '../build-x86_64-pc-linux-gnu/fixincludes/fixinc.sh', needed by 'stmp-fixinc'.  Stop.
make: *** Waiting for unfinished jobs....

Martin

> 
>> Right now, fixinclude takes about 11 seconds on my machine, where
>> it reads 130MB of header files.
>>
>> The number of fixed headers is negligible without any significant
>> change.
> 
> Please speak for Linux, but not for other targets ;-)
> 
> 	Rainer
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 11:15       ` Martin Liška
@ 2022-05-11 11:31         ` Rainer Orth
  2022-05-11 11:58           ` Martin Liška
  0 siblings, 1 reply; 18+ messages in thread
From: Rainer Orth @ 2022-05-11 11:31 UTC (permalink / raw)
  To: Martin Liška; +Cc: Joseph Myers, gcc-patches

Hi Martin,

>>> Subject: [PATCH] configure: add --disable-fix-includes
>> 
>> As I've mentioned before, I believe, the command is called fixincludes
>> in current gcc docs, and the option should reflect that, not introduce a
>> name used nowhere else.
>
> No, I can't use it, because even with current master using --disable-fixincludes
> means the tool is not built at all. It results with:
>
> g++ -g -DIN_GCC -fPIC -fno-exceptions -fno-rtti
> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
> -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common
> -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -o
> build/genchecksum \
>     build/genchecksum.o ../build-x86_64-pc-linux-gnu/libiberty/pic/libiberty.a
> make: *** No rule to make target
> '../build-x86_64-pc-linux-gnu/fixincludes/fixinc.sh', needed by
> 'stmp-fixinc'.  Stop.
> make: *** Waiting for unfinished jobs....

and why not just fix that, rather than introducing yet another option?
This error suggests current --disable-fixincludes is useless on it's
own.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 11:31         ` Rainer Orth
@ 2022-05-11 11:58           ` Martin Liška
  2022-05-11 12:48             ` Andreas Schwab
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-05-11 11:58 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Joseph Myers, gcc-patches

On 5/11/22 13:31, Rainer Orth wrote:
> Hi Martin,
> 
>>>> Subject: [PATCH] configure: add --disable-fix-includes
>>>
>>> As I've mentioned before, I believe, the command is called fixincludes
>>> in current gcc docs, and the option should reflect that, not introduce a
>>> name used nowhere else.
>>
>> No, I can't use it, because even with current master using --disable-fixincludes
>> means the tool is not built at all. It results with:
>>
>> g++ -g -DIN_GCC -fPIC -fno-exceptions -fno-rtti
>> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
>> -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
>> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common
>> -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -o
>> build/genchecksum \
>>     build/genchecksum.o ../build-x86_64-pc-linux-gnu/libiberty/pic/libiberty.a
>> make: *** No rule to make target
>> '../build-x86_64-pc-linux-gnu/fixincludes/fixinc.sh', needed by
>> 'stmp-fixinc'.  Stop.
>> make: *** Waiting for unfinished jobs....
> 
> and why not just fix that, rather than introducing yet another option?

I would like to, but I don't understant autoconf much :/

@Joseph: Can you please help me why --disable-$foo disables building $foo
folder during the build?

Thanks,
Martin

> This error suggests current --disable-fixincludes is useless on it's
> own.
> 
> 	Rainer
> 


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 11:58           ` Martin Liška
@ 2022-05-11 12:48             ` Andreas Schwab
  2022-05-11 14:50               ` Martin Liška
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2022-05-11 12:48 UTC (permalink / raw)
  To: Martin Liška; +Cc: Rainer Orth, gcc-patches, Joseph Myers

On Mai 11 2022, Martin Liška wrote:

> @Joseph: Can you please help me why --disable-$foo disables building $foo
> folder during the build?

# Handle --disable-<component> generically.
for dir in $configdirs $build_configdirs $target_configdirs ; do
  dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
  varname=`echo $dirname | sed -e s/+/_/g`
  if eval test x\${enable_${varname}} "=" xno ; then
    noconfigdirs="$noconfigdirs $dir"
  fi
done

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 12:48             ` Andreas Schwab
@ 2022-05-11 14:50               ` Martin Liška
  2022-05-20 12:42                 ` Alexandre Oliva
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-05-11 14:50 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Rainer Orth, gcc-patches, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

On 5/11/22 14:48, Andreas Schwab wrote:
> On Mai 11 2022, Martin Liška wrote:
> 
>> @Joseph: Can you please help me why --disable-$foo disables building $foo
>> folder during the build?
> 
> # Handle --disable-<component> generically.
> for dir in $configdirs $build_configdirs $target_configdirs ; do
>   dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
>   varname=`echo $dirname | sed -e s/+/_/g`
>   if eval test x\${enable_${varname}} "=" xno ; then
>     noconfigdirs="$noconfigdirs $dir"
>   fi
> done
> 

Great, thanks!

Using that I provide v3 where I renamed the option to --{enable,disable}-fixincludes.

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-configure-add-disable-fixincludes.patch --]
[-- Type: text/x-patch, Size: 6800 bytes --]

From 2d3079a14ee26192ebbc81e7c9663ae49ad7a178 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Fri, 4 Feb 2022 13:42:14 +0100
Subject: [PATCH] configure: add --disable-fixincludes

Right now, fixinclude takes about 11 seconds on my machine, where
it reads 130MB of header files.

The number of fixed headers is negligible without any significant
change.

fixincludes/ChangeLog:

	* fixinc.in: Add early exit.

gcc/ChangeLog:

	* Makefile.in: Support enable_fixincludes.
	* configure.ac: Add --disable-fixincludes.
	* configure: Regenerate.
	* doc/install.texi: Document the newly added configure options.

ChangeLog:

	* configure.ac: Ignore --disable-fixincludes.
	* configure: Regenerate.
---
 configure             |  4 ++++
 configure.ac          |  4 ++++
 fixincludes/fixinc.in |  6 ++++++
 gcc/Makefile.in       |  6 ++++--
 gcc/configure         | 16 ++++++++++++++--
 gcc/configure.ac      |  6 ++++++
 gcc/doc/install.texi  |  7 +++++++
 7 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 5dcaab14ae9..fb3897585b8 100755
--- a/configure
+++ b/configure
@@ -9041,6 +9041,10 @@ fi
 for dir in $configdirs $build_configdirs $target_configdirs ; do
   dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
   varname=`echo $dirname | sed -e s/+/_/g`
+  # Skip --disable-fixincludes, it is handled in gcc/configure
+  if eval test x${varname} "=" xfixincludes ; then
+    continue
+  fi
   if eval test x\${enable_${varname}} "=" xno ; then
     noconfigdirs="$noconfigdirs $dir"
   fi
diff --git a/configure.ac b/configure.ac
index 85977482aee..a0466533a46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2305,6 +2305,10 @@ fi
 for dir in $configdirs $build_configdirs $target_configdirs ; do
   dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
   varname=`echo $dirname | sed -e s/+/_/g`
+  # Skip --disable-fixincludes, it is handled in gcc/configure
+  if eval test x${varname} "=" xfixincludes ; then
+    continue
+  fi
   if eval test x\${enable_${varname}} "=" xno ; then
     noconfigdirs="$noconfigdirs $dir"
   fi
diff --git a/fixincludes/fixinc.in b/fixincludes/fixinc.in
index 0bd8027a554..bc2494c9f3a 100755
--- a/fixincludes/fixinc.in
+++ b/fixincludes/fixinc.in
@@ -63,6 +63,12 @@ else
   esac
 fi
 
+if test "x$ENABLE_FIXINCLUDES" = "xno"
+then
+  echo "Skipping fixincludes"
+  exit 0
+fi
+
 # Define what target system we're fixing.
 #
 if test -r ./Makefile; then
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 31ff95500c9..f73c6a731b3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -401,6 +401,8 @@ PLUGINLIBS = @pluginlibs@
 
 enable_plugin = @enable_plugin@
 
+enable_fixincludes = @enable_fixincludes@
+
 # On MinGW plugin installation involves installing import libraries.
 ifeq ($(enable_plugin),yes)
   plugin_implib := $(if $(strip $(filter mingw%,$(host_os))),yes,no)
@@ -3248,8 +3250,8 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	    chmod a+rx $${fix_dir} || true; \
 	    (TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
 	      SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
-	      gcc_dir=`${PWD_COMMAND}` ; \
-	      export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
+	      gcc_dir=`${PWD_COMMAND}` ; ENABLE_FIXINCLUDES=${enable_fixincludes} \
+	      export TARGET_MACHINE srcdir SHELL MACRO_LIST ENABLE_FIXINCLUDES && \
 	      cd $(build_objdir)/fixincludes && \
 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
 	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
diff --git a/gcc/configure b/gcc/configure
index 5ce0557719a..04affa93864 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -839,6 +839,7 @@ with_float
 with_cpu
 enable_multiarch
 enable_multilib
+enable_fixincludes
 coverage_flags
 valgrind_command
 valgrind_path_defines
@@ -958,6 +959,7 @@ enable_werror_always
 enable_checking
 enable_coverage
 enable_gather_detailed_mem_stats
+enable_fixincludes
 enable_valgrind_annotations
 enable_multilib
 enable_multiarch
@@ -1688,6 +1690,7 @@ Optional Features:
                           Values are opt, noopt, default is noopt
   --enable-gather-detailed-mem-stats
                           enable detailed memory allocation stats gathering
+  --disable-fixincludes   skip fixing of includes
   --enable-valgrind-annotations
                           enable valgrind runtime interaction
   --enable-multilib       enable library support for multiple ABIs
@@ -7783,6 +7786,15 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check whether --enable-fixincludes was given.
+if test "${enable_fixincludes+set}" = set; then :
+  enableval=$enable_fixincludes;
+else
+  enable_fixincludes=yes
+fi
+
+
+
 # Check whether --enable-valgrind-annotations was given.
 if test "${enable_valgrind_annotations+set}" = set; then :
   enableval=$enable_valgrind_annotations;
@@ -19673,7 +19685,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19676 "configure"
+#line 19688 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19779,7 +19791,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19782 "configure"
+#line 19794 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23bee7010a3..80300f3caaf 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -842,6 +842,12 @@ gather_stats=`if test $enable_gather_detailed_mem_stats != no; then echo 1; else
 AC_DEFINE_UNQUOTED(GATHER_STATISTICS, $gather_stats,
 [Define to enable detailed memory allocation stats gathering.])
 
+AC_ARG_ENABLE(fixincludes,
+[AS_HELP_STRING([--disable-fixincludes],
+		[skip fixing of includes])], [],
+[enable_fixincludes=yes])
+AC_SUBST(enable_fixincludes)
+
 AC_ARG_ENABLE(valgrind-annotations,
 [AS_HELP_STRING([--enable-valgrind-annotations],
 		[enable valgrind runtime interaction])], [],
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 10bfceffceb..1d055bb190d 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2371,6 +2371,13 @@ For a native build and cross compiles that have target headers, the option's
 default is derived from glibc's behavior. When glibc clamps float_t to double,
 GCC follows and enables the option. For other cross compiles, the default is
 disabled.
+
+@item --enable-fixincludes
+@itemx --disable-fixincludes
+
+Enable fixing of system header files. GCC needs to install corrected versions
+of some system header files. This is because most target systems have
+some header files that won’t work with GCC unless they are changed.
 @end table
 
 @subheading Cross-Compiler-Specific Options
-- 
2.36.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] configure: add --disable-fix-includes
  2022-05-11 14:50               ` Martin Liška
@ 2022-05-20 12:42                 ` Alexandre Oliva
  2022-05-24 12:05                   ` [PATCH v2] Support --disable-fixincludes Martin Liška
  0 siblings, 1 reply; 18+ messages in thread
From: Alexandre Oliva @ 2022-05-20 12:42 UTC (permalink / raw)
  To: Martin Liška; +Cc: Andreas Schwab, gcc-patches, Joseph Myers

On May 11, 2022, Martin Liška <mliska@suse.cz> wrote:

> Ready to be installed?

Hmm...  I don't like that --disable-fixincludes would still configure,
build and even install fixincludes.  This would be surprising, given
that the semantics of disabling a component is to not even configure it.

How about leaving the top-level alone, and changing gcc/configure.ac to
clear STMP_FIXINC when --disable-fixincludes is given?

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2] Support --disable-fixincludes.
  2022-05-20 12:42                 ` Alexandre Oliva
@ 2022-05-24 12:05                   ` Martin Liška
  2022-05-25  5:37                     ` Alexandre Oliva
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-05-24 12:05 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Andreas Schwab, gcc-patches, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

On 5/20/22 14:42, Alexandre Oliva wrote:
> On May 11, 2022, Martin Liška <mliska@suse.cz> wrote:
> 
>> Ready to be installed?
> 
> Hmm...  I don't like that --disable-fixincludes would still configure,
> build and even install fixincludes.  This would be surprising, given
> that the semantics of disabling a component is to not even configure it.
> 
> How about leaving the top-level alone, and changing gcc/configure.ac to
> clear STMP_FIXINC when --disable-fixincludes is given?
> 

Sure, that's a good idea.

Allways install limits.h and syslimits.h header files
to include folder.

When --disable-fixincludes is used, then no systen header files
are fixed by the tools in fixincludes. Moreover, the fixincludes
tools are not built any longer.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

[-- Attachment #2: 0001-Support-disable-fixincludes.patch --]
[-- Type: text/x-patch, Size: 4455 bytes --]

From ba9bed4512d73d34d4c9bf5830e758097d517bc3 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 24 May 2022 13:06:07 +0200
Subject: [PATCH] Support --disable-fixincludes.

Allways install limits.h and syslimits.h header files
to include folder.

When --disable-fixincludes is used, then no systen header files
are fixed by the tools in fixincludes. Moreover, the fixincludes
tools are not built any longer.

gcc/ChangeLog:

	* Makefile.in: Always install limits.h and syslimits.h to
	include folder.
	* configure.ac: Assign STMP_FIXINC blank if
	--disable-fixincludes is used.
	* configure: Regenerate.
---
 gcc/Makefile.in  | 22 ++++++++--------------
 gcc/configure    | 10 ++++++++--
 gcc/configure.ac |  6 ++++++
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 97e5450ecb5..3ab8e36e1ed 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3153,19 +3153,20 @@ stmp-int-hdrs: $(STMP_FIXINC) $(T_GLIMITS_H) $(T_STDINT_GCC_H) $(USER_H) fixinc_
 	set -e; for ml in `cat fixinc_list`; do \
 	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
 	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
-	  fix_dir=include-fixed$${multi_dir}; \
+	  include_dir=include$${multi_dir}; \
 	  if $(LIMITS_H_TEST) ; then \
 	    cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
 	  else \
 	    cat $(T_GLIMITS_H) > tmp-xlimits.h; \
 	  fi; \
-	  $(mkinstalldirs) $${fix_dir}; \
-	  chmod a+rx $${fix_dir} || true; \
+	  $(mkinstalldirs) $${include_dir}; \
+	  chmod a+rx $${include_dir} || true; \
 	  $(SHELL) $(srcdir)/../move-if-change \
 	    tmp-xlimits.h  tmp-limits.h; \
-	  rm -f $${fix_dir}/limits.h; \
-	  cp -p tmp-limits.h $${fix_dir}/limits.h; \
-	  chmod a+r $${fix_dir}/limits.h; \
+	  rm -f $${include_dir}/limits.h; \
+	  cp -p tmp-limits.h $${include_dir}/limits.h; \
+	  chmod a+r $${include_dir}/limits.h; \
+	  cp $(srcdir)/gsyslimits.h $${include_dir}/syslimits.h; \
 	done
 # Install the README
 	rm -f include-fixed/README
@@ -3255,13 +3256,6 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	      cd $(build_objdir)/fixincludes && \
 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
 	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
-	    rm -f $${fix_dir}/syslimits.h; \
-	    if [ -f $${fix_dir}/limits.h ]; then \
-	      mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \
-	    else \
-	      cp $(srcdir)/gsyslimits.h $${fix_dir}/syslimits.h; \
-	    fi; \
-	    chmod a+r $${fix_dir}/syslimits.h; \
 	  done; \
 	fi
 	$(STAMP) stmp-fixinc
@@ -3979,7 +3973,7 @@ install-mkheaders: stmp-int-hdrs install-itoolsdirs \
 	set -e; for ml in `cat fixinc_list`; do \
 	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
 	  $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}; \
-	  $(INSTALL_DATA) include-fixed$${multi_dir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
+	  $(INSTALL_DATA) include$${multi_dir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
 	done
 	$(INSTALL_SCRIPT) $(srcdir)/../mkinstalldirs \
 		$(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
diff --git a/gcc/configure b/gcc/configure
index 37e0dd5e414..711e8e9b559 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13548,6 +13548,12 @@ then
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 fi
 
+
+if test x$enable_fixincludes = xno;
+then
+    STMP_FIXINC=''
+fi
+
 # Expand extra_headers to include complete path.
 # This substitutes for lots of t-* files.
 extra_headers_list=
@@ -19674,7 +19680,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19676 "configure"
+#line 19683 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19780,7 +19786,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19782 "configure"
+#line 19789 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23bee7010a3..8a2dd5a193a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2501,6 +2501,12 @@ then
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 fi
 
+
+if test x$enable_fixincludes = xno;
+then
+    STMP_FIXINC=''
+fi
+
 # Expand extra_headers to include complete path.
 # This substitutes for lots of t-* files.
 extra_headers_list=
-- 
2.36.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-05-24 12:05                   ` [PATCH v2] Support --disable-fixincludes Martin Liška
@ 2022-05-25  5:37                     ` Alexandre Oliva
  2022-07-08 11:14                       ` Martin Liška
  0 siblings, 1 reply; 18+ messages in thread
From: Alexandre Oliva @ 2022-05-25  5:37 UTC (permalink / raw)
  To: Martin Liška; +Cc: Andreas Schwab, gcc-patches, Joseph Myers

On May 24, 2022, Martin Liška <mliska@suse.cz> wrote:

> Allways install limits.h and syslimits.h header files
> to include folder.

typo: s/Allways/Always/

I'm a little worried about this bit, too.  limitx.h includes
"syslimits.h", mentioning it should be in the same directory.  Perhaps
it could be left in include-fixed?

The patch also changes syslimits.h from either the fixincluded file or
gsyslimits.h to use gsyslimits.h unconditionally, which seemed wrong at
first.

Now I see how these two hunks work together: syslimits.h will now always
#include_next <limits.h>, which will find it in include-fixed if it's
there, and system header files otherwise.  Nice!, but IMHO the commit
message could be a little more verbose on the extent of the change and
why that (is supposed to) work.


It also looks like install-mkheaders installs limits-related headers for
when fixincludes runs; we could probably skip the whole thing if
fixincludes is disabled, but I'm also worried about how the changes
above might impact post-install fixincludes: if that installs
gsyslimits.h et al in include-fixed while your changes moves it to
include, headers might end up in a confusing state.  I haven't worked
out whether that's safe, but there appears to be room for cleanups
there.

gcc/config/mips/t-sdemtk also places syslimits.h explicitly in include/
rather than include-fixed/, as part of disabling fixincludes, which is
good, but it could be cleaned up as well.

I don't see other config fragments that might require adjustments, so I
think the patch looks good; hopefully my worries are unjustified, and
the cleanups it enables could be


We still create the README file in there and install it, even with
fixincludes disabled and thus unavailable, don't we?  That README then
becomes misleading; we might be better off not installing it.


> When --disable-fixincludes is used, then no systen header files
> are fixed by the tools in fixincludes. Moreover, the fixincludes
> tools are not built any longer.

typo: s/systen/system/


Could you please check that a post-install mkheaders still has a
functional limits.h with these changes?  The patch is ok (with the typo
fixes) if so.  The cleanups it enables would be welcome as separate
patches ;-)

Thanks!

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-05-25  5:37                     ` Alexandre Oliva
@ 2022-07-08 11:14                       ` Martin Liška
  2022-07-09 16:11                         ` Jeff Law
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Liška @ 2022-07-08 11:14 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Andreas Schwab, gcc-patches, Joseph Myers

[-- Attachment #1: Type: text/plain, Size: 2942 bytes --]

On 5/25/22 07:37, Alexandre Oliva wrote:
> On May 24, 2022, Martin Liška <mliska@suse.cz> wrote:
> 
>> Allways install limits.h and syslimits.h header files
>> to include folder.
> 
> typo: s/Allways/Always/

Hello.

Fixed.

> 
> I'm a little worried about this bit, too.  limitx.h includes
> "syslimits.h", mentioning it should be in the same directory.  Perhaps
> it could be left in include-fixed?

Well, I would like to go w/o include-fixed if the option --disable-fixincludes is used.

> 
> The patch also changes syslimits.h from either the fixincluded file or
> gsyslimits.h to use gsyslimits.h unconditionally, which seemed wrong at
> first.
> 
> Now I see how these two hunks work together: syslimits.h will now always
> #include_next <limits.h>, which will find it in include-fixed if it's
> there, and system header files otherwise.  Nice!, but IMHO the commit
> message could be a little more verbose on the extent of the change and
> why that (is supposed to) work.

Oh, to be honest I'm not fully familiar with how these 2 files work together.
Can you explain it to me so that I can adjust the changelog entry correspondingly?

> 
> 
> It also looks like install-mkheaders installs limits-related headers for
> when fixincludes runs; we could probably skip the whole thing if
> fixincludes is disabled, but I'm also worried about how the changes
> above might impact post-install fixincludes: if that installs
> gsyslimits.h et al in include-fixed while your changes moves it to
> include, headers might end up in a confusing state.  I haven't worked
> out whether that's safe, but there appears to be room for cleanups
> there.

I've check that 'make install-mkheaders' work fine w/ and w/o --disable-fixincludes
after the patch.

> 
> gcc/config/mips/t-sdemtk also places syslimits.h explicitly in include/
> rather than include-fixed/, as part of disabling fixincludes, which is
> good, but it could be cleaned up as well.

Can we do that as a follow-up patch?

> 
> I don't see other config fragments that might require adjustments, so I
> think the patch looks good; hopefully my worries are unjustified, and
> the cleanups it enables could be

Good.

> 
> 
> We still create the README file in there and install it, even with
> fixincludes disabled and thus unavailable, don't we?  That README then
> becomes misleading; we might be better off not installing it.

Sure, fixed in v2 of the patch.

> 
> 
>> When --disable-fixincludes is used, then no systen header files
>> are fixed by the tools in fixincludes. Moreover, the fixincludes
>> tools are not built any longer.
> 
> typo: s/systen/system/

Fixed.

> 
> 
> Could you please check that a post-install mkheaders still has a
> functional limits.h with these changes?

How do I check that, please?

> The patch is ok (with the typo
> fixes) if so.  The cleanups it enables would be welcome as separate
> patches ;-)

Can I install the v2?

Martin

> 
> Thanks!
> 

[-- Attachment #2: 0001-Support-disable-fixincludes.patch --]
[-- Type: text/x-patch, Size: 4791 bytes --]

From d06f931329c456821acac45aa3d89922183161bc Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 24 May 2022 13:06:07 +0200
Subject: [PATCH] Support --disable-fixincludes.

Always install limits.h and syslimits.h header files
to include folder.

When --disable-fixincludes is used, then no system header files
are fixed by the tools in fixincludes. Moreover, the fixincludes
tools are not built any longer.

gcc/ChangeLog:

	* Makefile.in: Always install limits.h and syslimits.h to
	include folder.
	* configure.ac: Assign STMP_FIXINC blank if
	--disable-fixincludes is used.
	* configure: Regenerate.
---
 gcc/Makefile.in  | 30 +++++++++++++-----------------
 gcc/configure    | 10 ++++++++--
 gcc/configure.ac |  6 ++++++
 3 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 3ae23702426..b7883254324 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3164,24 +3164,27 @@ stmp-int-hdrs: $(STMP_FIXINC) $(T_GLIMITS_H) $(T_STDINT_GCC_H) $(USER_H) fixinc_
 	set -e; for ml in `cat fixinc_list`; do \
 	  sysroot_headers_suffix=`echo $${ml} | sed -e 's/;.*$$//'`; \
 	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
-	  fix_dir=include-fixed$${multi_dir}; \
+	  include_dir=include$${multi_dir}; \
 	  if $(LIMITS_H_TEST) ; then \
 	    cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
 	  else \
 	    cat $(T_GLIMITS_H) > tmp-xlimits.h; \
 	  fi; \
-	  $(mkinstalldirs) $${fix_dir}; \
-	  chmod a+rx $${fix_dir} || true; \
+	  $(mkinstalldirs) $${include_dir}; \
+	  chmod a+rx $${include_dir} || true; \
 	  $(SHELL) $(srcdir)/../move-if-change \
 	    tmp-xlimits.h  tmp-limits.h; \
-	  rm -f $${fix_dir}/limits.h; \
-	  cp -p tmp-limits.h $${fix_dir}/limits.h; \
-	  chmod a+r $${fix_dir}/limits.h; \
+	  rm -f $${include_dir}/limits.h; \
+	  cp -p tmp-limits.h $${include_dir}/limits.h; \
+	  chmod a+r $${include_dir}/limits.h; \
+	  cp $(srcdir)/gsyslimits.h $${include_dir}/syslimits.h; \
 	done
 # Install the README
-	rm -f include-fixed/README
-	cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
-	chmod a+r include-fixed/README
+	if [ x$(STMP_FIXINC) != x ]; then \
+	  rm -f include-fixed/README; \
+	  cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README; \
+	  chmod a+r include-fixed/README; \
+	fi;
 	$(STAMP) $@
 
 .PHONY: install-gcc-tooldir
@@ -3266,13 +3269,6 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
 	      cd $(build_objdir)/fixincludes && \
 	      $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
 	        $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
-	    rm -f $${fix_dir}/syslimits.h; \
-	    if [ -f $${fix_dir}/limits.h ]; then \
-	      mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \
-	    else \
-	      cp $(srcdir)/gsyslimits.h $${fix_dir}/syslimits.h; \
-	    fi; \
-	    chmod a+r $${fix_dir}/syslimits.h; \
 	  done; \
 	fi
 	$(STAMP) stmp-fixinc
@@ -3990,7 +3986,7 @@ install-mkheaders: stmp-int-hdrs install-itoolsdirs \
 	set -e; for ml in `cat fixinc_list`; do \
 	  multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
 	  $(mkinstalldirs) $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}; \
-	  $(INSTALL_DATA) include-fixed$${multi_dir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
+	  $(INSTALL_DATA) include$${multi_dir}/limits.h $(DESTDIR)$(itoolsdatadir)/include$${multi_dir}/limits.h; \
 	done
 	$(INSTALL_SCRIPT) $(srcdir)/../mkinstalldirs \
 		$(DESTDIR)$(itoolsdir)/mkinstalldirs ; \
diff --git a/gcc/configure b/gcc/configure
index 62872d132ea..bd9408e0613 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13548,6 +13548,12 @@ then
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 fi
 
+
+if test x$enable_fixincludes = xno;
+then
+    STMP_FIXINC=''
+fi
+
 # Expand extra_headers to include complete path.
 # This substitutes for lots of t-* files.
 extra_headers_list=
@@ -19674,7 +19680,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19679 "configure"
+#line 19683 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19780,7 +19786,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19785 "configure"
+#line 19789 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 446747311a6..9bec9cf9c85 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2501,6 +2501,12 @@ then
     BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
 fi
 
+
+if test x$enable_fixincludes = xno;
+then
+    STMP_FIXINC=''
+fi
+
 # Expand extra_headers to include complete path.
 # This substitutes for lots of t-* files.
 extra_headers_list=
-- 
2.36.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-07-08 11:14                       ` Martin Liška
@ 2022-07-09 16:11                         ` Jeff Law
  2022-08-31  4:30                           ` Xi Ruoyao
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Law @ 2022-07-09 16:11 UTC (permalink / raw)
  To: gcc-patches



On 7/8/2022 5:14 AM, Martin Liška wrote:
> On 5/25/22 07:37, Alexandre Oliva wrote:
>> On May 24, 2022, Martin Liška <mliska@suse.cz> wrote:
>>
>>> Allways install limits.h and syslimits.h header files
>>> to include folder.
>> typo: s/Allways/Always/
> Hello.
>
> Fixed.
>
>> I'm a little worried about this bit, too.  limitx.h includes
>> "syslimits.h", mentioning it should be in the same directory.  Perhaps
>> it could be left in include-fixed?
> Well, I would like to go w/o include-fixed if the option --disable-fixincludes is used.
>
>> The patch also changes syslimits.h from either the fixincluded file or
>> gsyslimits.h to use gsyslimits.h unconditionally, which seemed wrong at
>> first.
>>
>> Now I see how these two hunks work together: syslimits.h will now always
>> #include_next <limits.h>, which will find it in include-fixed if it's
>> there, and system header files otherwise.  Nice!, but IMHO the commit
>> message could be a little more verbose on the extent of the change and
>> why that (is supposed to) work.
> Oh, to be honest I'm not fully familiar with how these 2 files work together.
> Can you explain it to me so that I can adjust the changelog entry correspondingly?
>
>>
>> It also looks like install-mkheaders installs limits-related headers for
>> when fixincludes runs; we could probably skip the whole thing if
>> fixincludes is disabled, but I'm also worried about how the changes
>> above might impact post-install fixincludes: if that installs
>> gsyslimits.h et al in include-fixed while your changes moves it to
>> include, headers might end up in a confusing state.  I haven't worked
>> out whether that's safe, but there appears to be room for cleanups
>> there.
> I've check that 'make install-mkheaders' work fine w/ and w/o --disable-fixincludes
> after the patch.
>
>> gcc/config/mips/t-sdemtk also places syslimits.h explicitly in include/
>> rather than include-fixed/, as part of disabling fixincludes, which is
>> good, but it could be cleaned up as well.
> Can we do that as a follow-up patch?
>
>> I don't see other config fragments that might require adjustments, so I
>> think the patch looks good; hopefully my worries are unjustified, and
>> the cleanups it enables could be
> Good.
>
>>
>> We still create the README file in there and install it, even with
>> fixincludes disabled and thus unavailable, don't we?  That README then
>> becomes misleading; we might be better off not installing it.
> Sure, fixed in v2 of the patch.
>
>>
>>> When --disable-fixincludes is used, then no systen header files
>>> are fixed by the tools in fixincludes. Moreover, the fixincludes
>>> tools are not built any longer.
>> typo: s/systen/system/
> Fixed.
>
>>
>> Could you please check that a post-install mkheaders still has a
>> functional limits.h with these changes?
> How do I check that, please?
>
>> The patch is ok (with the typo
>> fixes) if so.  The cleanups it enables would be welcome as separate
>> patches ;-)
> Can I install the v2?
Once Alex is OK with this patch, then it'll be good to go.

jeff

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-07-09 16:11                         ` Jeff Law
@ 2022-08-31  4:30                           ` Xi Ruoyao
  2022-08-31  4:30                             ` Xi Ruoyao
  2022-08-31 15:25                             ` Alexandre Oliva
  0 siblings, 2 replies; 18+ messages in thread
From: Xi Ruoyao @ 2022-08-31  4:30 UTC (permalink / raw)
  To: Jeff Law, gcc-patches; +Cc: Alexandre Oliva

On Sat, 2022-07-09 at 10:11 -0600, Jeff Law via Gcc-patches wrote:

> Once Alex is OK with this patch, then it'll be good to go.
> 
> jeff

Gentle ping as a distro maintainer :).

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-08-31  4:30                           ` Xi Ruoyao
@ 2022-08-31  4:30                             ` Xi Ruoyao
  2022-08-31 15:25                             ` Alexandre Oliva
  1 sibling, 0 replies; 18+ messages in thread
From: Xi Ruoyao @ 2022-08-31  4:30 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

On Sat, 2022-07-09 at 10:11 -0600, Jeff Law via Gcc-patches wrote:

> Once Alex is OK with this patch, then it'll be good to go.
> 
> jeff

Gentle ping as a distro maintainer :).

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] Support --disable-fixincludes.
  2022-08-31  4:30                           ` Xi Ruoyao
  2022-08-31  4:30                             ` Xi Ruoyao
@ 2022-08-31 15:25                             ` Alexandre Oliva
  1 sibling, 0 replies; 18+ messages in thread
From: Alexandre Oliva @ 2022-08-31 15:25 UTC (permalink / raw)
  To: Xi Ruoyao, Martin Liška; +Cc: Jeff Law, gcc-patches

On Aug 31, 2022, Xi Ruoyao <xry111@xry111.site> wrote:

> On Sat, 2022-07-09 at 10:11 -0600, Jeff Law via Gcc-patches wrote:
>> Once Alex is OK with this patch, then it'll be good to go.
>> 
>> jeff

> Gentle ping as a distro maintainer :).

Oops, thanks, sorry, I seem to have missed it the first time around.

The patch looks good to me, thanks Martin,

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-08-31 15:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:03 [PATCH] configure: add --disable-fix-includes Martin Liška
2022-05-09  9:31 ` Andreas Schwab
2022-05-09 21:14 ` Joseph Myers
2022-05-11 10:55   ` Martin Liška
2022-05-11 11:00     ` Rainer Orth
2022-05-11 11:15       ` Martin Liška
2022-05-11 11:31         ` Rainer Orth
2022-05-11 11:58           ` Martin Liška
2022-05-11 12:48             ` Andreas Schwab
2022-05-11 14:50               ` Martin Liška
2022-05-20 12:42                 ` Alexandre Oliva
2022-05-24 12:05                   ` [PATCH v2] Support --disable-fixincludes Martin Liška
2022-05-25  5:37                     ` Alexandre Oliva
2022-07-08 11:14                       ` Martin Liška
2022-07-09 16:11                         ` Jeff Law
2022-08-31  4:30                           ` Xi Ruoyao
2022-08-31  4:30                             ` Xi Ruoyao
2022-08-31 15:25                             ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).