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

Mikael Morin mikael.morin@sfr.fr
Sat Jul 14 14:08:00 GMT 2012


On 14/07/2012 15:45, Steven Bosscher wrote:
> On Sat, Jul 14, 2012 at 3:23 PM, Tobias Burnus <burnus@net-b.de> wrote:
>> Steven Bosscher wrote:
>>>
>>> On Thu, Jul 12, 2012 at 11:29 AM, Tobias Burnus <burnus@net-b.de> wrote:
>>>>
>>>> On 07/07/2012 11:28 PM, Steven Bosscher wrote:
>>>>>
>>>>> 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.  

Well it makes sense to me, actually.
The frontend has internal structures to represent symbols, expressions
etc, and it attaches the corresponding backend representations in those
structures.  And the backend representation has type tree, so it needs
this from coretypes.h:

union tree_node;
typedef union tree_node *tree;

It's a black box type, as the type definition is not in coretypes.h (at
least in my few days old trunk).  So the backend is kept separated from
the frontend.  What's wrong with that?

[...]

>> If one now includes "tree.h" in gfortran.h, it fails because "tree.h"
>> includes "vecir.h", which has at the top:
>> #ifndef GCC_CORETYPES_H
>> #error "vecir.h must be included after coretypes.h"
>> #endif
>>
Silly question: why don't they just include coretypes.h here?

Mikael



More information about the Gcc-patches mailing list