X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=bin%2Ferrs12;h=a1ef03504026ebb48a51f259b1617683985f4290;hb=dce36e0ee9cfaa98c6215ebb2f11266ebc5f0b66;hp=a679861588e5441ab30327f0566aa0eea637e99c;hpb=4e621b85cdc130479357d4920e4c088407fa3248;p=nethome.git diff --git a/bin/errs12 b/bin/errs12 index a679861..a1ef035 100755 --- a/bin/errs12 +++ b/bin/errs12 @@ -12,8 +12,13 @@ customm="-m64" target= targets= configure="./configure" -debug="-ggdb2" -ldflags="-lmcheck" +# >=4.7 has small macros section. +if gcc --version|perl -ne 'exit(!(/(\d+)\.(\d+)/&&($1>4||($1==4&&$2>=7))));';then + debug="-g3" +else + debug="-g2" +fi +mcheck="-lmcheck" fast=false readline="" @@ -60,7 +65,12 @@ do if [ "$1" = "-s" ];then # -O0 is important to override GCC -O2. debug="-O0 -s" - #ldflags="" + shift + continue + fi + + if [ "$1" = "--nomcheck" ];then + mcheck="" shift continue fi @@ -109,17 +119,22 @@ rm -f errs1.ok test -z "$CC" && CC=gcc : >errs1.c - for flags in \ - "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4" \ - "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions" \ - "" \ + # -Wp,-D_FORTIFY_SOURCE=2: /usr/include/features.h:329:3: error: #warning _FORTIFY_SOURCE requested but disabled [-Werror=cpp] + for flags in \ + "$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 --param=ssp-buffer-size=4" \ + "$debug -pipe -Wall -fexceptions" \ + "" \ ;do if [ -z "$flags" ];then rm -f errs1.c echo >&2 "flags error" exit 1 fi - "$CC" $flags -c errs1.c -o /dev/null && break + # Use -Werror: + # cc1: warnings being treated as errors + # archive.c:1: error: -fstack-protector not supported for this target + "$CC" $flags -Werror -c errs1.c -o /dev/null && break done if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then flags="$customm $flags" @@ -130,7 +145,7 @@ rm -f errs1.ok export GCJFLAGS="$flags" export CFLAGS_FOR_TARGET="$flags" export CXXFLAGS_FOR_TARGET="$flags" - export LDFLAGS="$ldflags" + export LDFLAGS="$mcheck" time nice "$configure" $target $targets $customss $readline --enable-debug --disable-sim --enable-gold --enable-plugins $maintainer $werror --with-separate-debug-dir=/usr/lib/debug "$@"