[iso_c_binding] Add symbolic id for symbols coming from intrinsic modules
Christopher D. Rickett
crickett@lanl.gov
Sun Jan 21 22:24:00 GMT 2007
currently i have an attribute in symbol_attribute that states whether a
symbol is from the iso_c_binding module. it should be possible to remove
this now with FX's patch.
thanks.
Chris
> Hi all,
>
> The following patch, commited to the fortran-experiments branch after
> bootstrap and regtesting on i686-linux, adds symbolic id to the
> symbols created from intrinsic modules. This will probably make our
> life easier in some parts of the ISO_C_BINDING by being able to
> uniquely identify if a given symbol comes from an intrinsic module,
> which intrinsic module it's coming from and what symbol it is
> exactly. It will also be required for the future integration of the
> IEEE modules (but I'll only start working on that when ISO_C_BINDING
> is merged into mainline, I promise!)
>
> It does so by adding two new fields to the gfc_symbol structure:
> + from_intmod is INTMOD_NONE (that is, 0) when a symbol does not
> come from an intrinsic module, and the module ID number (defined in
> the intmod_id enumeration) : INTMOD_ISO_FORTRAN_ENV or
> INTMOD_ISO_C_BINDING.
> + intmod_sym_id is the numeric id of the symbol, which is unique
> to each defined entity in a given intrinsic module; that is, an enum
> is set up for each intrinsic module (I'm reusing
> iso_c_binding_symbol, in fact, and adding iso_fortran_env_symbol)
>
> This enabled me to rework the ISO_FORTRAN_ENV code a bit, avoiding a
> few (always expensive) string comparisons. The overall patch is very
> limited, as you can see (most of it is the module.c ISO_FORTRAN_ENV
> reworking).
>
> FX
>
>
> 2007-01-21 Francois-Xavier Coudert <coudert@clipper.ens.fr>
>
> * gfortran.h: Add new fields from_intmod and intmod_sym_id
> to the
> gfc_symbol structure, to keep track of symbols coming from
> intrinsic modules so we can special-case them when needed.
> * symbol.c (generate_isocbinding_symbol): Set these new fields.
> * module.c: Set these new fields, and use the fact that we know
> have a symbolic id per symbol to rework the code dealing with
> ISO_FORTRAN_ENV.
>
>
More information about the Fortran
mailing list