From 8dba0e5d2ea2c27384b1ee818c57fa41288acf1b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 8 Jan 2020 00:58:14 -0800 Subject: gcc: disable annoying code quoting. Newer versions of gcc add a lot of aggravating spewage to the diagnostics, by including copies of the lines of code where the error occurs followed by a line showing the error location with a caret and some tilde underlining. * configure: new test to see whether the compiler emits a caret line for a program that has a syntax error (missing closing brace). If so, we test whether the compiler accepts the option -fno-diagnostics-show-caret, and if so, we add that option to DIAG_FLAGS in config.make. --- configure | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/configure b/configure index d157c5b2..a621a9f8 100755 --- a/configure +++ b/configure @@ -908,6 +908,33 @@ else printf " n/a\n" fi +printf "Checking for disabling source code quoting in compiler errors ... " + +cat > conftest.c < +int main(void) +{ +! + +if ! conftest && grep -q -E '^ +\^' conftest.err ; then + cat > conftest.c < +int main(void) +{ +return 0; +} +! + opt=-fno-diagnostics-show-caret + if conftest EXTRA_FLAGS=$opt ; then + printf "needed\n" + diag_flags="$diag_flags $opt" + else + printf "unable\n" + fi +else + printf "no need\n" +fi + # # Check for annoying clashes from non-conforming BSD-derived systems that don't # honor Unix/POSIX feature selection macros! -- cgit v1.2.3