aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-10-09 17:36:18 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-10-09 17:36:18 +0200
commit28d0b595667285b8d95e5dd024f76b365f60ade8 (patch)
tree02963e6f8d6c620cb110c18215cafdb4c88e2374 /gcc/fortran/module.c
parent3a0a3578217e5b5d36589d7f6a68bc68bbcc53de (diff)
downloadgcc-28d0b595667285b8d95e5dd024f76b365f60ade8.zip
gcc-28d0b595667285b8d95e5dd024f76b365f60ade8.tar.gz
gcc-28d0b595667285b8d95e5dd024f76b365f60ade8.tar.bz2
Make-lang.in (F95_PARSER_OBJS, [...]): Add dependency on iso-c-binding.def and iso-fortran-env.def.
2011-10-09 Tobias Burnus <burnus@net-b.de> * Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add dependency on iso-c-binding.def and iso-fortran-env.def. * module.c (import_iso_c_binding_module): Add error when explicitly importing a nonstandard symbol; extend standard- depending loading. * iso-c-binding.def: Add c_float128 and c_float128_complex integer parameters (for -std=gnu). * intrinsic.texi (ISO_C_Binding): Document them. * symbol.c (generate_isocbinding_symbol): Change macros to ignore GFC_STD_* data. * trans-types.c (gfc_init_c_interop_kinds): Ditto; make nonstatic and renamed from "init_c_interop_kinds". (gfc_init_kinds): Don't call it * trans-types.h (gfc_init_c_interop_kinds): Add prototype. * f95-lang.c (gfc_init_decl_processing): Call it. 2011-10-09 Tobias Burnus <burnus@net-b.de> * gfortran.dg/iso_c_binding_param_1.f90: New. * gfortran.dg/iso_c_binding_param_2.f90: New. * gfortran.dg/c_sizeof_2.f90: Update dg-error. From-SVN: r179725
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c105
1 files changed, 93 insertions, 12 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index c8a377d..62f7598 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -5350,8 +5350,53 @@ import_iso_c_binding_module (void)
for (u = gfc_rename_list; u; u = u->next)
if (strcmp (c_interop_kinds_table[i].name, u->use_name) == 0)
{
+ bool not_in_std;
+ const char *name;
u->found = 1;
found = true;
+
+ switch (i)
+ {
+#define NAMED_FUNCTION(a,b,c,d) \
+ case a: \
+ not_in_std = (gfc_option.allow_std & d) == 0; \
+ name = b; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_FUNCTION
+#define NAMED_INTCST(a,b,c,d) \
+ case a: \
+ not_in_std = (gfc_option.allow_std & d) == 0; \
+ name = b; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_INTCST
+#define NAMED_REALCST(a,b,c,d) \
+ case a: \
+ not_in_std = (gfc_option.allow_std & d) == 0; \
+ name = b; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_REALCST
+#define NAMED_CMPXCST(a,b,c,d) \
+ case a: \
+ not_in_std = (gfc_option.allow_std & d) == 0; \
+ name = b; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_CMPXCST
+ default:
+ not_in_std = false;
+ name = "";
+ }
+
+ if (not_in_std)
+ {
+ gfc_error ("The symbol '%s', referenced at %C, is not "
+ "in the selected standard", name);
+ continue;
+ }
+
switch (i)
{
#define NAMED_FUNCTION(a,b,c,d) \
@@ -5374,23 +5419,59 @@ import_iso_c_binding_module (void)
}
if (!found && !only_flag)
- switch (i)
- {
+ {
+ /* Skip, if the symbol is not in the enabled standard. */
+ switch (i)
+ {
+#define NAMED_FUNCTION(a,b,c,d) \
+ case a: \
+ if ((gfc_option.allow_std & d) == 0) \
+ continue; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_FUNCTION
+
+#define NAMED_INTCST(a,b,c,d) \
+ case a: \
+ if ((gfc_option.allow_std & d) == 0) \
+ continue; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_INTCST
+#define NAMED_REALCST(a,b,c,d) \
+ case a: \
+ if ((gfc_option.allow_std & d) == 0) \
+ continue; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_REALCST
+#define NAMED_CMPXCST(a,b,c,d) \
+ case a: \
+ if ((gfc_option.allow_std & d) == 0) \
+ continue; \
+ break;
+#include "iso-c-binding.def"
+#undef NAMED_CMPXCST
+ default:
+ ; /* Not GFC_STD_* versioned. */
+ }
+
+ switch (i)
+ {
#define NAMED_FUNCTION(a,b,c,d) \
- case a: \
- if ((gfc_option.allow_std & d) == 0) \
- continue; \
- create_intrinsic_function (b, (gfc_isym_id) c, \
- iso_c_module_name, \
- INTMOD_ISO_C_BINDING); \
+ case a: \
+ create_intrinsic_function (b, (gfc_isym_id) c, \
+ iso_c_module_name, \
+ INTMOD_ISO_C_BINDING); \
break;
#include "iso-c-binding.def"
#undef NAMED_FUNCTION
- default:
- generate_isocbinding_symbol (iso_c_module_name,
- (iso_c_binding_symbol) i, NULL);
- }
+ default:
+ generate_isocbinding_symbol (iso_c_module_name,
+ (iso_c_binding_symbol) i, NULL);
+ }
+ }
}
for (u = gfc_rename_list; u; u = u->next)