From 28d0b595667285b8d95e5dd024f76b365f60ade8 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sun, 9 Oct 2011 17:36:18 +0200 Subject: Make-lang.in (F95_PARSER_OBJS, [...]): Add dependency on iso-c-binding.def and iso-fortran-env.def. 2011-10-09 Tobias Burnus * 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 * 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 --- gcc/fortran/module.c | 105 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 93 insertions(+), 12 deletions(-) (limited to 'gcc/fortran/module.c') 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) -- cgit v1.1