public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] Only use -finput-charset=ascii iff compiler supports it
Date: Mon, 4 Apr 2022 12:58:11 +0000 (GMT) [thread overview]
Message-ID: <20220404125811.864273858036@sourceware.org> (raw)
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 ++-
| 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)
--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
next reply other threads:[~2022-04-04 12:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 12:58 Adhemerval Zanella [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-17 20:11 Adhemerval Zanella
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 21:24 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-03-31 19:10 Adhemerval Zanella
2022-03-29 20:34 Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220404125811.864273858036@sourceware.org \
--to=azanella@sourceware.org \
--cc=glibc-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).