[patch][fortran] Include coretypes.h in .c files, not in gfortran.h

Steven Bosscher stevenb.gcc@gmail.com
Sat Jul 7 21:29:00 GMT 2012


Hello,

Currently, gcc/flags.h and fortran/gfortran.h both include
coretypes.h. In many fortran/*.c files, flags.h is included before
gfortran.h, so when flags.h no longer includes coretypes.h (xf.
http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00275.html) gfortran no
longer builds without some changes.

I must say, I am surprised that gfortran.h includes coretypes.h. The
idea always was to try and keep the front end and the back end as much
separated as possible, and including coretypes.h in the most important
front-end header doesn't fit in that picture.  I initially tried to
just stop including flags.h in e.g. fortran/arith.c because I couldn't
think of anything that arith.h should know from flags.h, but that
breaks the build because arith.c looks at 'pedantic' from the
generated file options.h. Next, I considered adding pedantic to
gfc_options, but that, of course, clashes with the define in options.h
(it's a macro so a field named 'pedantic' in gfc_options isn't
possible. Oh well... I've added removing the middle-end dependencies
from the front end to my TODO list.

For now, the solution I disliked the least is to include coretypes.h
explicitly in the C files that need it. It really doesn't change
anything (gfortran.h already included it) but it makes this dependency
explicit, at least.

Bootstrapped&tested on powerpc64-unknown-linux-gnu and on
x86_64-unknown-linux-gnu, will commit in a few days.

Ciao!
Steven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fortran_coretypes.diff
Type: application/octet-stream
Size: 11148 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120707/4a589718/attachment.obj>


More information about the Gcc-patches mailing list