Skip to content

Commit

Permalink
getconf detection: cope with new compiler messages
Browse files Browse the repository at this point in the history
conf.sh checks for undefined symbols by parsing compiler output and
looking for strings of capital letters and underscores. Modern gcc
produces suggestions for replacement variables too, for example:

error: '_SC_CLOCKRES_MIN' undeclared here (not in a function); did you mean _POSIX_CLOCKRES_MIN?
 _SC_CLOCKRES_MIN,
 ^~~~~~~~~~~~~~~~
 _POSIX_CLOCKRES_MIN

This causes good variables to be excluded along with bad, causing differences
between the builtin and system getconf commands.

src/lib/libast/comp/conf.sh:
- Only use lines containing 'error:' and ignore everything starting
  from 'did you mean:'. (Note this scripts sets the locale to C.)

Patch from @citrus-it:
citrus-it@061a4b1
  • Loading branch information
McDutchie committed Jan 15, 2021
1 parent 649f4b0 commit 3aa01a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/libast/comp/conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,8 @@ unsigned int conf[] = {
[ -f $tmp.1.e ] || cp $tmp.e $tmp.1.e
snl='\
'
sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" $tmp.e |
grep 'error:' $tmp.e | sed "s/did you mean.*//" |
sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" |
grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' |
sort -u > $tmp.n
cmp -s $tmp.n $tmp.p && break
Expand Down

0 comments on commit 3aa01a9

Please sign in to comment.