diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-03-25 13:58:03 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-04-17 16:12:41 -0300 |
commit | 8a082445f819697811eef589ef246204316335ac (patch) | |
tree | 978023ddbb3db82fe8f57e08648d7ccb73adab12 | |
parent | faae5301b6dfdea58593d4fa87cc8690b6bd3223 (diff) | |
download | glibc-8a082445f819697811eef589ef246204316335ac.zip glibc-8a082445f819697811eef589ef246204316335ac.tar.gz glibc-8a082445f819697811eef589ef246204316335ac.tar.bz2 |
Only use -finput-charset=ascii iff compiler supports it
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | Rules | 2 | ||||
-rwxr-xr-x | configure | 24 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | scripts/check-installed-headers.sh | 12 |
5 files changed, 46 insertions, 3 deletions
@@ -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) @@ -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) @@ -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 99a0ea1..9846f28 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 b8cdcbf..25a7f26 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 |