Along the lines of adding the -pedantic option, I would like to add an 
ability (probably at ./configure time) to specify additional compile 
options.  Since one of my platforms is a Mac, I would like to be able to 
add -wno_long_double, as it keeps telling me that their size is 
non-portable.

Thanks,

Jonathan Polley


On Monday, July 1, 2002, at 05:43 PM, Julian Foad wrote:

> I now have a practical solution for saving the compiler warnings: a 
> wrapper script replacement for the compiler.
>
>   rm config.cache  # Otherwise it keeps the previous values of CC and CXX.
>   GCCFLAGS="-Wall -pedantic -Wpointer-arith"
>   CC="saveoutp gcc" CXX="saveoutp c++" CFLAGS="$GCCFLAGS" 
> CXXFLAGS="$GCCFLAGS" ./configure
>
> where ~/bin/saveoutp contains:
>
>   #!/bin/bash
>
>   # Run a program, also capturing stderr to a file.
>   #
>   # Usage: saveoutp <program> <option>... <filename>
>   #
>   # Treat the argument list as a shell command.  Run the command, 
> displaying
>   # stderr but also capturing it into a file named ".deps/<filename>.err"
> .
>   # (Bug: the command's exit status is reduced to just true or false.)
>
>   if [ -d .deps ] ; then
>
>     # Make name of error file from last positional argument.
>     ERRFILE=.deps/${!#}.err
>
>     # Execute program; save stderr; display stderr; return true/false 
> exit code.
>     { $* 2> $ERRFILE && cat $ERRFILE >&2; } || { cat $ERRFILE >&2; false;
>  }
>
>   else
>
>     $*
>
>   fi
>
> This wrapper script is specific to Bash, but it would be possible to 
> write one for any shell that can redirect stderr, or even write a 
> compiled program.
>
> Then you will always have the last warnings available for each C file and 
> can run (e.g.)
>
>   cat src/*/.deps/*.err
>
> to see them.
>
>
> [
> My previous attempt was no good.  I wrote:
>>
>> 2. Save the error output for each C file as (e.g.) ".deps/*.err".  E.g. 
>> in each Makefile.in:
> ...
>> +         $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< 2> .deps/$(*F).err
> ...
>
> But if the compilation fails, 'make' will quit before displaying the 
> error output file.  That's no good.  It needs to be done within a single 
> command.  What I really need is one of these:
>
>   gcc 2| tee file.err            # No: stderr->pipe not available AFAIK, 
> and exit status is lost.
>   gcc 2> file.err 2> /dev/con    # No: in Bash the first output file has 
> nothing written to it.
>   gcc 2>(tee file.err)           # No, though Bash can _almost_ do this 
> on _some_ systems.
>   gcc 2> file.err || { cat file.err; false; }   # This might just about 
> work!
>
> ... but I don't know if I can get automake to put stuff like this in the 
> generated make files.
> ]
>
>
> - Julian
>
> _______________________________________________
> Flightgear-devel mailing list
> [EMAIL PROTECTED]
> http://mail.flightgear.org/mailman/listinfo/flightgear-devel


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to