cpp.c (gfc_cpp_init): Add pre-defined macros for INTEGER(1) INTEGER(2)...
2018-12-25 Steven G. Kargl <kargl@gcc.gnu.org> * cpp.c (gfc_cpp_init): Add pre-defined macros for INTEGER(1) INTEGER(2), INTEGER(8) and INTEGER(16) if supported. Add pre-defined macros for REAL(10) and REAL(16) if available. * gfortran.texi: Document new macros. From-SVN: r267464
This commit is contained in:
parent
40b1bb9f3b
commit
0b774babfb
@ -1,3 +1,10 @@
|
||||
2018-12-29 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
* cpp.c (gfc_cpp_init): Add pre-defined macros for INTEGER(1)
|
||||
INTEGER(2), INTEGER(8) and INTEGER(16) if supported. Add pre-defined
|
||||
macros for REAL(10) and REAL(16) if available.
|
||||
* gfortran.texi: Document new macros.
|
||||
|
||||
2018-12-27 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/81027
|
||||
|
@ -609,6 +609,28 @@ gfc_cpp_init (void)
|
||||
opt->arg, opt->code == OPT_MQ);
|
||||
}
|
||||
|
||||
/* Pre-defined macros for non-required INTEGER kind types. */
|
||||
for (gfc_integer_info *itype = gfc_integer_kinds; itype->kind != 0; itype++)
|
||||
{
|
||||
if (itype->kind == 1)
|
||||
cpp_define (cpp_in, "__GFC_INT_1__=1");
|
||||
if (itype->kind == 2)
|
||||
cpp_define (cpp_in, "__GFC_INT_2__=1");
|
||||
if (itype->kind == 8)
|
||||
cpp_define (cpp_in, "__GFC_INT_8__=1");
|
||||
if (itype->kind == 16)
|
||||
cpp_define (cpp_in, "__GFC_INT_16__=1");
|
||||
}
|
||||
|
||||
/* Pre-defined macros for non-required REAL kind types. */
|
||||
for (gfc_real_info *rtype = gfc_real_kinds; rtype->kind != 0; rtype++)
|
||||
{
|
||||
if (rtype->kind == 10)
|
||||
cpp_define (cpp_in, "__GFC_REAL_10__=1");
|
||||
if (rtype->kind == 16)
|
||||
cpp_define (cpp_in, "__GFC_REAL_16__=1");
|
||||
}
|
||||
|
||||
if (gfc_cpp_option.working_directory
|
||||
&& gfc_cpp_option.preprocess_only && !gfc_cpp_option.no_line_commands)
|
||||
pp_dir_change (cpp_in, get_src_pwd ());
|
||||
|
@ -418,10 +418,18 @@ statement, the included file is not preprocessed. To preprocess included
|
||||
files, use the equivalent preprocessor statement @code{#include}.
|
||||
|
||||
If GNU Fortran invokes the preprocessor, @code{__GFORTRAN__}
|
||||
is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and
|
||||
is defined. The macros @code{__GNUC__}, @code{__GNUC_MINOR__} and
|
||||
@code{__GNUC_PATCHLEVEL__} can be used to determine the version of the
|
||||
compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details.
|
||||
|
||||
GNU Fortran supports a number of @code{INTEGER} and @code{REAL} kind types
|
||||
in additional to the kind types required by the Fortran standard.
|
||||
The availability of any given kind type is architecture dependent. The
|
||||
following pre-defined preprocessor macros can be used to conditional
|
||||
include code for these additional kind types: @code{__GFC_INTEGER_1__},
|
||||
@code{__GFC_INTEGER_2__}, @code{__GFC_INTEGER_8__}, @code{__GFC_INTEGER_16__},
|
||||
@code{__GFC_REAL_10__}, and @code{__GFC_REAL_16__}.
|
||||
|
||||
While CPP is the de-facto standard for preprocessing Fortran code,
|
||||
Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines
|
||||
Conditional Compilation, which is not widely used and not directly
|
||||
|
Loading…
Reference in New Issue
Block a user