bin/errs12: Update.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 19 Feb 2021 16:42:01 +0000 (17:42 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 19 Feb 2021 16:42:01 +0000 (17:42 +0100)
bin/errs12

index bfac6f5..fd308d3 100755 (executable)
@@ -19,6 +19,7 @@ if gcc --version|perl -ne 'exit(!(/(\d+)\.(\d+)/&&($1>4||($1==4&&$2>=7))));';the
 else
   debug="-g2"
 fi
+permissive=""
 asan=""
 #asan="-fsanitize=address -static-libasan"
 mcheck=""
@@ -26,6 +27,7 @@ mcheck=""
 fast=false
 readline=""
 disablebinutils="--disable-binutils --disable-gas --disable-gold --disable-gprof --disable-ld"
+python=""
 
 while true
 do
@@ -74,6 +76,12 @@ do
                continue
        fi
 
+       if [ "$1" = "-fpermissive" ];then
+               permissive="-fpermissive"
+               shift
+               continue
+       fi
+
        if [ "$1" = "--asan" ];then
                asan="-fsanitize=address -static-libasan"
                shift
@@ -93,7 +101,7 @@ do
        fi
 
        if [ "$1" = "--binutils" ];then
-               disablebinutils=""
+               disablebinutils="--enable-gold"
                shift
                continue
        fi
@@ -123,7 +131,7 @@ rm -f errs1.ok
        if ! $fast && test -f `dirname $configure`/bfd/elf64-x86-64.c -a '(' -d CVS -o -d .git ')';then
                targets="$targets --enable-targets=all"
        fi
-       if test ! -d readline;then # $fast ||
+       if test ! -e readline/readline/display.c;then # $fast ||
                targets="$targets --with-system-readline"
        fi
 
@@ -143,13 +151,23 @@ rm -f errs1.ok
                readline="--with-system-readline"
        fi
 
+       if test -z "$python";then
+               if [ -x /usr/bin/python3 ];then
+                       python="--with-python=/usr/bin/python3"
+               fi
+       fi
+
        test -z "$CC" && CC=gcc
        : >errs1.c
        # -Wp,-D_FORTIFY_SOURCE=2: /usr/include/features.h:329:3: error: #warning _FORTIFY_SOURCE requested but disabled [-Werror=cpp]
+       # -ftrack-macro-expansion=0:
+       # hash.c:535:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
+       # hash.c:535:5: note: ...this ‘if’ clause, but it is not
        for flags in                                                                                                                                    \
-               "$debug -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret $asan"        \
-               "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret $asan"       \
-               "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret"     \
+               "$debug -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagnostics-show-caret -Wno-error=cast-function-type -Wno-error=stringop-truncation -Wno-error=format-truncation $asan"        \
+               "$debug -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -fno-diagnostics-show-caret $asan"  \
+               "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fno-diagnostics-show-caret $asan" \
+               "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fno-diagnostics-show-caret"       \
                "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4"                                                           \
                "$debug -pipe -Wall -fexceptions"                                                                                                       \
                ""                                                                                                                                      \
@@ -167,18 +185,28 @@ rm -f errs1.ok
        if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then
                flags="$customm $flags"
        fi
+       echo 'int main (void) { return 0; }' >errs1.c
+       for ldflags in \
+               "-fuse-ld=gold -Wl,--gdb-index -ltcmalloc" \
+               "-fuse-ld=gold -Wl,--gdb-index" \
+               "-ltcmalloc" \
+               "" \
+       ;do
+               "$CC" $flags $ldflags errs1.c -o /dev/null && break
+       done
        rm -f errs1.c
        if ! echo "$flags"|grep -q 'fsanitize=address';then
                asan=""
        fi
+       flags="$flags -D_GLIBCXX_DEBUG"
        export CFLAGS="$flags"
-       export CXXFLAGS="$flags"
+       export CXXFLAGS="$flags $permissive"
        export GCJFLAGS="$flags"
        export CFLAGS_FOR_TARGET="$flags"
-       export CXXFLAGS_FOR_TARGET="$flags"
-       export LDFLAGS="$mcheck $asan"
+       export CXXFLAGS_FOR_TARGET="$flags $permissive"
+       export LDFLAGS="$ldflags $mcheck $asan"
 
-       time nice "$configure" $target $targets $customss $readline $disablebinutils --enable-debug --disable-sim $maintainer $werror --with-separate-debug-dir=/usr/lib/debug --without-guile "$@"
+       time nice "$configure" $target $targets $customss $readline $disablebinutils $python --enable-debug --disable-sim $maintainer $werror --with-separate-debug-dir=/usr/lib/debug --without-guile "$@"
 # --enable-gold --enable-plugins
 
        (ctags; test -d gdb && (cd gdb; ctags; cd testsuite; ctags; cd ../gdbserver; ctags)) &