[Patch] gcc/toplev.{c,h} + PR fortran/{40569,40568} compiler_options() + fixes

Tobias Burnus burnus@net-b.de
Tue Sep 28 10:23:00 GMT 2010


  The  gcc/toplev.{c,h} part of the patch needs middle-end review, the 
rest is in the Fortran FE.

The patch exports the "save_decoded_options" in gcc/toplev.{c,h} and 
uses it in gcc/fortran/options.c to construct a string with the compiler 
flags.

Additionally changed:
- Add documentation
- Include compiler name in compiler_version ("value that identi
es the 
name and version [...] of the processor")
- Mark the functions as inquiry functions


The patch was build and loosely tested. It is currently bootstrapping 
and will then be regtested on x86-64-linux. OK for the trunk?


Example:
    use iso_fortran_env
    print '(5a)', 'This file was compiled by "', &
                  compiler_version(), '" using the the options "', &
                  compiler_options(),'"'
    end

That gives:

$ gfortran -march=native -m32 hjf34.f90 && ./a.out
This file was compiled by "GCC version 4.6.0 20100928 (experimental) 
[trunk revision 164668]" using the the options "-march=k8-sse3 -msahf 
--param l1-cache-size=64 --param l1-cache-line-size=64 --param 
l2-cache-size=1024 -mtune=k8 -m32"

$ gfortran -Dignored hjf34.f90 && ./a.out
This file was compiled by "GCC version 4.6.0 20100928 (experimental) 
[trunk revision 164668]" using the the options "-mtune=generic 
-march=x86-64"

$ gfortran -Dwith=cpp -cpp hjf34.f90 && ./a.out
This file was compiled by "GCC version 4.6.0 20100928 (experimental) 
[trunk revision 164668]" using the the options "-cpp -D with=cpp 
-mtune=generic -march=x86-64"


Tobias

PS: Still to do: -Wall fixes (bogus warning regarding functions already 
typed), inquiry fixes in expr.c's check_inquiry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiler_options.diff
Type: text/x-patch
Size: 11323 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100928/a12208bc/attachment.bin>


More information about the Fortran mailing list