public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-06-09 21:24 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:24 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=751ac17f4e2b767659f8703da22be620e1dc57a5

commit 751ac17f4e2b767659f8703da22be620e1dc57a5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 179dd478ff..778dd20eab 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2024-04-02 15:58 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 15:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f0e3aac9f88a6efbb6c7aa26c3fda8e0c20683a8

commit f0e3aac9f88a6efbb6c7aa26c3fda8e0c20683a8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7052b46df8..cf7fa7a370 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index c7db0a4869..d90f019629 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index 1ff91a6810..c47702608e 100755
--- a/configure
+++ b/configure
@@ -7487,6 +7487,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 99a0ea1bbb..9846f28d05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1546,6 +1546,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index b8cdcbf858..25a7f2605d 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2024-02-09 17:36 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2024-02-09 17:36 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6691b99fe6c49db60ac114e13c118b32433675d3

commit 6691b99fe6c49db60ac114e13c118b32433675d3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7052b46df8..cf7fa7a370 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index c7db0a4869..d90f019629 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index c148a663f3..296fcb6e0b 100755
--- a/configure
+++ b/configure
@@ -7484,6 +7484,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 24fb4adb7b..80bf04627b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,6 +1543,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index b8cdcbf858..25a7f2605d 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2024-02-07 14:11 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2024-02-07 14:11 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6abb12244272cfb37f5f85cbf4693be5405ec564

commit 6abb12244272cfb37f5f85cbf4693be5405ec564
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7052b46df8..cf7fa7a370 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index c7db0a4869..d90f019629 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index c148a663f3..296fcb6e0b 100755
--- a/configure
+++ b/configure
@@ -7484,6 +7484,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 24fb4adb7b..80bf04627b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,6 +1543,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index b8cdcbf858..25a7f2605d 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2024-01-29 18:01 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2024-01-29 18:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3798d78d115a1fec04c75bdf298bb92443c3fcad

commit 3798d78d115a1fec04c75bdf298bb92443c3fcad
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7052b46df8..cf7fa7a370 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index c7db0a4869..d90f019629 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index c148a663f3..296fcb6e0b 100755
--- a/configure
+++ b/configure
@@ -7484,6 +7484,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 24fb4adb7b..80bf04627b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,6 +1543,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index b8cdcbf858..25a7f2605d 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2023-12-21 18:58 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2023-12-21 18:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e049bb38dea6ec31549c9298b9cc74f27f2b541f

commit e049bb38dea6ec31549c9298b9cc74f27f2b541f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index a4f3378e21..e4ff783820 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index 279ae490ac..a569af838c 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index 019d306c48..5bc371dd41 100755
--- a/configure
+++ b/configure
@@ -7483,6 +7483,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 24fb4adb7b..80bf04627b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,6 +1543,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index ee9f534ab0..b097a5b4e5 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2023-09-28 17:56 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2023-09-28 17:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9fd866d9a7ac9b55b6a796df207aa3cd0899e451

commit 9fd866d9a7ac9b55b6a796df207aa3cd0899e451
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c6d4817a9e..88df6ac33e 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index 279ae490ac..a569af838c 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index 289d1efdaa..ef0584f920 100755
--- a/configure
+++ b/configure
@@ -7609,6 +7609,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index b7ae62ce6f..3243ed1f71 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1608,6 +1608,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index ee9f534ab0..b097a5b4e5 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2023-08-30 12:41 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2023-08-30 12:41 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=700f2ada87da98fa6574d6825633a164aab85506

commit 700f2ada87da98fa6574d6825633a164aab85506
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 24 ++++++++++++++++++++++++
 configure.ac                       |  9 +++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c6d4817a9e..88df6ac33e 100644
--- a/Makefile
+++ b/Makefile
@@ -546,6 +546,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -556,6 +557,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/Rules b/Rules
index 279ae490ac..a569af838c 100644
--- a/Rules
+++ b/Rules
@@ -86,6 +86,7 @@ libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
@@ -98,6 +99,7 @@ libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
+	  $(config-cflags-charset-ascii) \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
 	  $(headers) > $@; \
 	$(evaluate-test)
diff --git a/configure b/configure
index 49c39abcd3..92f4cd5f03 100755
--- a/configure
+++ b/configure
@@ -7585,6 +7585,30 @@ printf "%s\n" "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+printf %s "checking if $CC supports -finput-charset=ascii... " >&6; }
+if test ${libc_cv_cc_charset_ascii+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_charset_ascii="yes"
+else $as_nop
+  libc_cv_cc_charset_ascii="no"
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+printf "%s\n" "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 printf %s "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 934e9e0c9f..eb4afa81f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1600,6 +1600,15 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii="yes"],
+		   [libc_cv_cc_charset_ascii="no"])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index ee9f534ab0..b097a5b4e5 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -33,8 +33,8 @@ lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 # maximum value to be checked is define by maximum_fortify argument.
 fortify_modes=""
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ maximum_fortify \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ maximum_fortify finput-charset \"compile command\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -53,6 +53,12 @@ esac
 shift
 fortify_modes=$(seq -s' ' 1 $1)
 shift
+if [ "$1" = "yes" ]; then
+  finputcharset="-finput-charset=ascii"
+else
+  finputcharset=""
+fi
+shift
 cc_cmd="$1"
 shift
 trap "rm -f '$cih_test_c'" 0
@@ -130,7 +136,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-                if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+                if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		           "$cih_test_c" 2>&1
                 then :
                 else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2023-02-09 19:52 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2023-02-09 19:52 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=28396b7ee87df0b7673af133544e90144e853425

commit 28396b7ee87df0b7673af133544e90144e853425
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 224c792185..d97979f30b 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index fdff415fdc..29e556bfe4 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index b9ba9958c2..6c5ee947ea 100755
--- a/configure
+++ b/configure
@@ -6362,6 +6362,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 6f97d8d4b0..68d80cb591 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1616,6 +1616,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 5a50a491ca..7efb4ba980 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-10-28 17:46 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-10-28 17:46 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=df5a6c220c9c26d6ddcfda68a3df013faf57287d

commit df5a6c220c9c26d6ddcfda68a3df013faf57287d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 179dd478ff..778dd20eab 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 9b3f3ffa5d..dba81022bf 100755
--- a/configure
+++ b/configure
@@ -6581,6 +6581,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index fbc24f9119..149a897ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1626,6 +1626,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-10-04 13:03 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 13:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=57f08ba63076e25029043d78d2cfa6e0f2c6d7ee

commit 57f08ba63076e25029043d78d2cfa6e0f2c6d7ee
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 scripts/check-installed-headers.sh | 12 +++++++++---
 5 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 179dd478ff..778dd20eab 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 9b3f3ffa5d..dba81022bf 100755
--- a/configure
+++ b/configure
@@ -6581,6 +6581,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index fbc24f9119..149a897ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1626,6 +1626,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1

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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-06-09 13:20 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:20 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=751ac17f4e2b767659f8703da22be620e1dc57a5

commit 751ac17f4e2b767659f8703da22be620e1dc57a5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 179dd478ff..778dd20eab 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-06-03 14:09 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:09 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f4c55942365e3139760e3ae1814ca75e6513b4f0

commit f4c55942365e3139760e3ae1814ca75e6513b4f0
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index a9722a161c..a4f675f4c7 100644
--- a/Makefile
+++ b/Makefile
@@ -544,6 +544,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -554,6 +555,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-05-13 14:23 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:23 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=699f1cde7e3b610212df671c3ee32dbf8911840b

commit 699f1cde7e3b610212df671c3ee32dbf8911840b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-05-12 19:37 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:37 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3a702a3872929b69e091fd8fab16f1a10ce57098

commit 3a702a3872929b69e091fd8fab16f1a10ce57098
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-05-10 18:27 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:27 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7f67552f371b9b4b333477fd1038077e6c9855e8

commit 7f67552f371b9b4b333477fd1038077e6c9855e8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 709a572377..a651196339 100755
--- a/configure
+++ b/configure
@@ -6627,6 +6627,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 8c9c70fca3..f002e928a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1609,6 +1609,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-04-29 14:07 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:07 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6d18242cc1f5e93185b2ee2b255b985a1b08752

commit b6d18242cc1f5e93185b2ee2b255b985a1b08752
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 688ded0da9..ba07a13369 100755
--- a/configure
+++ b/configure
@@ -6655,6 +6655,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 3cff0b801f..1d6076b09e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1625,6 +1625,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-04-04 12:58 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8cef1306f3f6dc2babcbb86ca343dbb347052024

commit 8cef1306f3f6dc2babcbb86ca343dbb347052024
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 2f60e8dc66..6abcd4f479 100755
--- a/configure
+++ b/configure
@@ -6782,6 +6782,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 966e12af76..3024e72cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1741,6 +1741,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-03-31 19:10 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:10 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bba9639ba5160a22ff10e50ec5ad217c861b6870

commit bba9639ba5160a22ff10e50ec5ad217c861b6870
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 2f60e8dc66..6abcd4f479 100755
--- a/configure
+++ b/configure
@@ -6782,6 +6782,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 966e12af76..3024e72cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1741,6 +1741,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

* [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
@ 2022-03-29 20:34 Adhemerval Zanella
  0 siblings, 0 replies; 20+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:34 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=45a62ee8aa3e96182fbb2d086b4b72d61300e96e

commit 45a62ee8aa3e96182fbb2d086b4b72d61300e96e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 25 13:58:03 2022 -0300

    Only use -finput-charset=ascii iff compiler supports it

Diff:
---
 Makefile                           |  2 ++
 Rules                              |  2 ++
 configure                          | 22 ++++++++++++++++++++++
 configure.ac                       | 10 ++++++++++
 intl/Makefile                      |  3 ++-
 scripts/check-installed-headers.sh | 12 +++++++++---
 6 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index b1454882bd..d520abf9dd 100644
--- a/Makefile
+++ b/Makefile
@@ -543,6 +543,7 @@ $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -553,6 +554,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/Rules b/Rules
index ac9455d6a7..91cf297aa5 100644
--- a/Rules
+++ b/Rules
@@ -90,6 +90,7 @@ $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
 	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 
@@ -102,6 +103,7 @@ $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
 	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(config-cflags-charset-ascii) \
 	  $(headers) > $@; \
 	$(evaluate-test)
 endif # $(CXX)
diff --git a/configure b/configure
index 2f60e8dc66..6abcd4f479 100755
--- a/configure
+++ b/configure
@@ -6782,6 +6782,28 @@ $as_echo "$libc_cv_cc_trampoline" >&6; }
 config_vars="$config_vars
 have-cc-trampoline = $libc_cv_cc_trampoline"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -finput-charset=ascii" >&5
+$as_echo_n "checking if $CC supports -finput-charset=ascii... " >&6; }
+if ${libc_cv_cc_charset_ascii+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -finput-charset=ascii -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  libc_cv_cc_charset_ascii=yes
+else
+  libc_cv_cc_charset_ascii=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_charset_ascii" >&5
+$as_echo "$libc_cv_cc_charset_ascii" >&6; }
+config_vars="$config_vars
+config-cflags-charset-ascii = $libc_cv_cc_charset_ascii"
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5
 $as_echo_n "checking for libgd... " >&6; }
 if test "$with_gd" != "no"; then
diff --git a/configure.ac b/configure.ac
index 966e12af76..3024e72cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1741,6 +1741,16 @@ rm -f conftest*])
 LIBC_CONFIG_VAR([have-cc-trampoline],
 		[$libc_cv_cc_trampoline])
 
+dnl Check if -finput-charset accepts ascii
+AC_CACHE_CHECK([if $CC supports -finput-charset=ascii],
+	       libc_cv_cc_charset_ascii, [dnl
+LIBC_TRY_CC_OPTION([-Werror -finput-charset=ascii],
+		   [libc_cv_cc_charset_ascii=yes],
+		   [libc_cv_cc_charset_ascii=no])
+])
+LIBC_CONFIG_VAR([config-cflags-charset-ascii],
+		[$libc_cv_cc_charset_ascii])
+
 dnl Check whether we have the gd library available.
 AC_MSG_CHECKING(for libgd)
 if test "$with_gd" != "no"; then
diff --git a/intl/Makefile b/intl/Makefile
index 315c75a18f..1c3b2a2273 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -154,7 +154,8 @@ $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
-	    -D'LOCALE_ALIAS_PATH="$(localedir)"'
+	    -D'LOCALE_ALIAS_PATH="$(localedir)"' \
+	    -Wno-unused-but-set-variable
 BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
 
 $(inst_localedir)/locale.alias: locale.alias $(+force)
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 0876d2643a..457902d3b4 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -29,8 +29,8 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # These are probably the most commonly used three.
 lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
 
-if [ $# -lt 3 ]; then
-    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+if [ $# -lt 4 ]; then
+    echo "usage: $0 c|c++ \"compile command\" \"yes|no\" header header header..." >&2
     exit 2
 fi
 case "$1" in
@@ -49,6 +49,12 @@ esac
 shift
 cc_cmd="$1"
 shift
+if [ "$1" = "yes" ]; then
+     finputcharset="-finput-charset=ascii"
+else
+     finputcharset=""
+fi
+shift
 trap "rm -f '$cih_test_c'" 0
 
 failed=0
@@ -118,7 +124,7 @@ $expanded_lib_mode
 #include <$header>
 int avoid_empty_translation_unit;
 EOF
-            if $cc_cmd -finput-charset=ascii -fsyntax-only $lang_mode \
+            if $cc_cmd $finputcharset -fsyntax-only $lang_mode \
 		       "$cih_test_c" 2>&1
             then :
             else failed=1


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

end of thread, other threads:[~2024-04-02 15:58 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 21:24 [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 15:58 Adhemerval Zanella
2024-02-09 17:36 Adhemerval Zanella
2024-02-07 14:11 Adhemerval Zanella
2024-01-29 18:01 Adhemerval Zanella
2023-12-21 18:58 Adhemerval Zanella
2023-09-28 17:56 Adhemerval Zanella
2023-08-30 12:41 Adhemerval Zanella
2023-02-09 19:52 Adhemerval Zanella
2022-10-28 17:46 Adhemerval Zanella
2022-10-04 13:03 Adhemerval Zanella
2022-06-09 13:20 Adhemerval Zanella
2022-06-03 14:09 Adhemerval Zanella
2022-05-13 14:23 Adhemerval Zanella
2022-05-12 19:37 Adhemerval Zanella
2022-05-10 18:27 Adhemerval Zanella
2022-04-29 14:07 Adhemerval Zanella
2022-04-04 12:58 Adhemerval Zanella
2022-03-31 19:10 Adhemerval Zanella
2022-03-29 20:34 Adhemerval Zanella

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).