diff mbox series

[15/15] Support for 64-bit location_t: Configury parts

Message ID 20241103222220.933471-16-lhyatt@gmail.com
State New
Headers show
Series Support for 64-bit location_t | expand

Commit Message

Lewis Hyatt Nov. 3, 2024, 10:22 p.m. UTC
Add --enable-large-source-locations (off by default for now) to enable
64-bit location_t.

gcc/ChangeLog:

	* configure.ac: Add --enable-large-source-locations.
	* config.in: Regenerate.
	* configure: Regenerate.
	* doc/install.texi: Document the new option.

libcpp/ChangeLog:

	* configure.ac: Add --enable-large-source-locations.
	* config.in: Regenerate.
	* configure: Regenerate.
---
 libcpp/config.in     |  3 +++
 libcpp/configure     | 17 +++++++++++++++++
 libcpp/configure.ac  | 11 +++++++++++
 gcc/config.in        |  6 ++++++
 gcc/configure        | 21 +++++++++++++++++++--
 gcc/configure.ac     | 11 +++++++++++
 gcc/doc/install.texi | 15 +++++++++++++++
 7 files changed, 82 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libcpp/config.in b/libcpp/config.in
index b2e2f4e842c..74ff169a322 100644
--- a/libcpp/config.in
+++ b/libcpp/config.in
@@ -20,6 +20,9 @@ 
 /* Define to enable system headers canonicalization. */
 #undef ENABLE_CANONICAL_SYSTEM_HEADERS
 
+/* Define to enable 64-bit locations. */
+#undef ENABLE_LARGE_SOURCE_LOCATIONS
+
 /* Define to 1 if translation of program messages to the user's native
    language is requested. */
 #undef ENABLE_NLS
diff --git a/libcpp/configure b/libcpp/configure
index 1391081ba09..eca82ab568f 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -753,6 +753,7 @@  enable_host_shared
 enable_host_pie
 enable_cet
 enable_valgrind_annotations
+enable_large_source_locations
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1397,6 +1398,8 @@  Optional Features:
   --enable-cet            enable Intel CET in host libraries [default=auto]
   --enable-valgrind-annotations
                           enable valgrind runtime interaction
+  --enable-large-source-locations
+                          enable 64-bit source locations
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -9416,6 +9419,20 @@  $as_echo "#define ENABLE_VALGRIND_WORKAROUNDS 1" >>confdefs.h
 
 fi
 
+# Specify whether to use 64-bit locations
+# Check whether --enable-large-source-locations was given.
+if test "${enable_large_source_locations+set}" = set; then :
+  enableval=$enable_large_source_locations;
+else
+  enable_large_source_locations=no
+fi
+
+if test x$enable_large_source_locations != xno; then
+
+$as_echo "#define ENABLE_LARGE_SOURCE_LOCATIONS 1" >>confdefs.h
+
+fi
+
 # Output.
 
 ac_config_headers="$ac_config_headers config.h:config.in"
diff --git a/libcpp/configure.ac b/libcpp/configure.ac
index 981f97c4abd..091bbc44537 100644
--- a/libcpp/configure.ac
+++ b/libcpp/configure.ac
@@ -246,6 +246,17 @@  if test x$enable_valgrind_annotations != xno \
  possible memory leaks because of libcpp use of interior pointers.])
 fi
 
+# Specify whether to use 64-bit locations
+AC_ARG_ENABLE([large-source-locations],
+[AC_HELP_STRING([--enable-large-source-locations],
+                [enable 64-bit source locations])],
+[],
+enable_large_source_locations=no)
+if test x$enable_large_source_locations != xno; then
+  AC_DEFINE(ENABLE_LARGE_SOURCE_LOCATIONS,
+            1, [Define to enable 64-bit locations.])
+fi
+
 # Output.
 
 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
diff --git a/gcc/config.in b/gcc/config.in
index 0a506d1783a..ed779e78a12 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -206,6 +206,12 @@ 
 #endif
 
 
+/* Define to enable 64-bit locations. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_LARGE_SOURCE_LOCATIONS
+#endif
+
+
 /* Define if gcc should always pass --build-id to linker. */
 #ifndef USED_FOR_TARGET
 #undef ENABLE_LD_BUILDID
diff --git a/gcc/configure b/gcc/configure
index 150ab616414..490f070c820 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1059,6 +1059,7 @@  with_diagnostics_urls
 enable_default_pie
 enable_cet
 enable_s390_excess_float_precision
+enable_large_source_locations
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1832,6 +1833,8 @@  Optional Features:
   --enable-s390-excess-float-precision
                           on s390 targets, evaluate float with double
                           precision when in standards-conforming mode
+  --enable-large-source-locations
+                          enable 64-bit source locations
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -21454,7 +21457,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21457 "configure"
+#line 21460 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21560,7 +21563,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21563 "configure"
+#line 21566 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -34912,6 +34915,20 @@  _ACEOF
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fhardened_support" >&5
 $as_echo "$fhardened_support" >&6; }
 
+# Specify whether to use 64-bit locations
+# Check whether --enable-large-source-locations was given.
+if test "${enable_large_source_locations+set}" = set; then :
+  enableval=$enable_large_source_locations;
+else
+  enable_large_source_locations=no
+fi
+
+if test x$enable_large_source_locations != xno; then
+
+$as_echo "#define ENABLE_LARGE_SOURCE_LOCATIONS 1" >>confdefs.h
+
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index bdb22d53e2c..c742229db47 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7951,6 +7951,17 @@  AC_DEFINE_UNQUOTED(HAVE_FHARDENED_SUPPORT,
   [Define 0/1 if -fhardened is supported])
 AC_MSG_RESULT($fhardened_support)
 
+# Specify whether to use 64-bit locations
+AC_ARG_ENABLE([large-source-locations],
+[AC_HELP_STRING([--enable-large-source-locations],
+                [enable 64-bit source locations])],
+[],
+enable_large_source_locations=no)
+if test x$enable_large_source_locations != xno; then
+  AC_DEFINE(ENABLE_LARGE_SOURCE_LOCATIONS,
+            1, [Define to enable 64-bit locations.])
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index b562b0f38d6..7bb643be8aa 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2607,6 +2607,21 @@  include and lib options directly.
 
 These flags are applicable to the host platform only.  When building
 a cross compiler, they will not be used to configure target libraries.
+
+@item --enable-large-source-locations
+In order to reduce peak memory usage, GCC uses an optimized data
+structure for storing the locations of source code it has parsed from
+its input.  This structure uses a 32-bit key to represent source
+locations, which restricts the number of lines and columns that can be
+tracked (per source file, or within one source file) for sufficiently
+large source files.  This can become evident as a degradation in the
+quality of diagnostics; those users who want to support large source
+files without encountering such issues and do not mind the extra
+memory consumption may use @option{--enable-large-source-locations}
+to switch to a 64-bit location type that is free of such practical
+issues.  This may become the default for some targets in a future
+version of GCC.
+
 @end table
 
 @subheading Cross-Compiler-Specific Options