From 2e839d8775bc05b6cee305b03bd4fb9ed568898d Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sat, 16 Jan 2021 14:43:22 +0000 Subject: [PATCH] getconf detection: fix compiler error msg extraction (re: 3aa01a95) That patch didn't work for non-gcc, non-clang compilers -- at least Solaris Studio cc. It doesn't prefix error messages with "error:". As a result, it caused the build to fail on Solaris with native cc. src/lib/libast/comp/conf.sh: - Use a sed formula that should catch error messages prefixed by "line xx:" while still removing warnings and suggestions. This works on at least clang, gcc, Solaris Studio cc. --- src/lib/libast/comp/conf.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/libast/comp/conf.sh b/src/lib/libast/comp/conf.sh index f1d845408..b56182e44 100644 --- a/src/lib/libast/comp/conf.sh +++ b/src/lib/libast/comp/conf.sh @@ -833,7 +833,9 @@ unsigned int conf[] = { [ -f $tmp.1.e ] || cp $tmp.e $tmp.1.e snl='\ ' - grep 'error:' $tmp.e | sed "s/did you mean.*//" | + # Extract failing identifiers. Try to isolate compiler errors while eliminating suggestions. + # As of 2021, known to work on: gcc, clang, Solaris Studio cc + sed -n 's/[Dd]id you mean.*//; /[Ww]arning:/ d; /[Ee]rror:/ p; /[Ll]ine [0-9][0-9]*:/ p' $tmp.e | sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" | grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' | sort -u > $tmp.n