[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libc6-dev and "-pedantic -O" warnings



Hi,
>>"Chris" == Chris Waters <xtifr@dsp.net> writes:

 Chris> Kirk Hilliard <kirk@ghoti.com> writes:
 >> $ gcc -pedantic -O toupper.c
 >> toupper.c: In function `main':
 >> toupper.c:5: warning: ANSI C forbids braced-groups within expressions
 >> $

 >> Is this a bug, or can we no longer expect well written code to compile
 >> warning free when optimizing?

 Chris> The libraries (and in particular, the headers) use non-ANSI-C
 Chris> features that are supported by gcc,

        In other words, we have a non conforming system, then? 

 Chris> if possible, but if you then use -pedantic, you'll get
 Chris> warnings about these features from the compiler.  The

        I would hope so. Why would one wish to promote non-standard
 code? 

 Chris> -pendantic is designed primarily to be used with the -ansi
 Chris> switch.  The gcc docs recommend *against* using -pedantic.  If
 Chris> you want full warnings, use -Wall, not -pedantic.

 Chris>   $ gcc -O2 -Wall toupper.c
 Chris>   $

 Chris> The moral of the story is, -pedantic is probably not the switch you
 Chris> wanted.

        Au contraire. You really have not tried to code portably, have
 you? This is what I use for my production code:

        manoj

#!/bin/bash 
if [ -x /bin/tempfile ]; then
    outfile=`tempfile -p outp -m 0600 `;
else
    set -e
    mkdir /tmp/prompt$$
    outfile=/tmp/prompt$$/output
fi

exec gcc -ansi -pedantic -Wall -W -Wtraditional -Wconversion -Wshadow \
         -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align \
         -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
         -Wmissing-prototypes -Wmissing-declarations \
         -fshort-enums -fno-common -Dgets=DONT_USE_GETS -Dlint \
         -Woverloaded-virtual -Wnested-externs -Winline \
         -o $outfile -O4 -g -c $*

rm -f $outfile 
if [ -d /tmp/prompt$$ ]; then
    rmdir /tmp/prompt$$
fi


-- 
 "I thought you were trying to get into shape." "I am. The shape I've
 selected is a triangle."
Manoj Srivastava   <srivasta@debian.org>  <http://www.debian.org/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


Reply to: