diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2006-02-14 14:50:40 +0000 |
---|---|---|
committer | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2006-02-14 14:50:40 +0000 |
commit | 4f038218e3207204c12974cbac3a00b83b18e0ad (patch) | |
tree | 13cf5a927829ef2d53b1d8653b24a59f5c575ef2 | |
parent | 7871d5eb229a1c649d86f16324a003dbdcc57bdd (diff) |
PR libfortran/25425
* trans-decl.c (gfc_generate_function_code): Add new argument,
pedantic, to set_std call.
* libgfortran.h: Add pedantic field to compile_options struct.
* io/write.c (calculate_G_format): Depending on the standard,
choose E or F format for list-directed output of 0.0.
* runtime/error.c (notify_std): Make warning and error dependent
on pedanticity.
* runtime/compile_options.c (set_std): Use new pedantic argument.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch@110973 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 16 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 16 | ||||
-rw-r--r-- | libgfortran/io/write.c | 3 | ||||
-rw-r--r-- | libgfortran/libgfortran.h | 1 | ||||
-rw-r--r-- | libgfortran/runtime/compile_options.c | 7 | ||||
-rw-r--r-- | libgfortran/runtime/error.c | 5 |
7 files changed, 41 insertions, 13 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0714b0c8753..fc957c83a32 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-02-14 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/25425 + * trans-decl.c (gfc_generate_function_code): Add new argument, + pedantic, to set_std call. + 2006-02-13 Paul Thomas <pault@gcc.gnu.org> PR fortran/26074 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 9305a8b7900..858c7f91d5c 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2145,7 +2145,8 @@ gfc_build_builtin_function_decls (void) gfor_fndecl_set_std = gfc_build_library_function_decl (get_identifier (PREFIX("set_std")), void_type_node, - 2, + 3, + gfc_int4_type_node, gfc_int4_type_node, gfc_int4_type_node); @@ -2592,10 +2593,10 @@ gfc_generate_function_code (gfc_namespace * ns) /* Now generate the code for the body of this function. */ gfc_init_block (&body); - /* If this is the main program and we compile with -pedantic, add a call - to set_std to set up the runtime library Fortran language standard - parameters. */ - if (sym->attr.is_main_program && pedantic) + /* If this is the main program, add a call to set_std to set up the + runtime library Fortran language standard parameters. */ + + if (sym->attr.is_main_program) { tree arglist, gfc_int4_type_node; @@ -2606,7 +2607,10 @@ gfc_generate_function_code (gfc_namespace * ns) arglist = gfc_chainon_list (arglist, build_int_cst (gfc_int4_type_node, gfc_option.allow_std)); - tmp = gfc_build_function_call (gfor_fndecl_set_std, arglist); + arglist = gfc_chainon_list (arglist, + build_int_cst (gfc_int4_type_node, + pedantic)); + tmp = build_function_call_expr (gfor_fndecl_set_std, arglist); gfc_add_expr_to_block (&body, tmp); } diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 7157b42f98f..ffd46c133d1 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,4 +1,14 @@ -2005-02-08 Thomas Koenig <Thomas.Koenig@online.de> +2006-02-14 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/25425 + * libgfortran.h: Add pedantic field to compile_options struct. + * io/write.c (calculate_G_format): Depending on the standard, + choose E or F format for list-directed output of 0.0. + * runtime/error.c (notify_std): Make warning and error dependent + on pedanticity. + * runtime/compile_options.c (set_std): Use new pedantic argument. + +2006-02-08 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/23815 * runtime/environ.c (init_unformatted): Add GFORTRAN_CONVERT_UNIT @@ -33,8 +43,8 @@ 2006-02-07 Rainer Emrich <r.emrich@de.tecosim.com> * intrinsics/c99_functions.c: Work around incompatible - declarations of cabs{,f,l} on pre-C99 IRIX systems. - + declarations of cabs{,f,l} on pre-C99 IRIX systems. + 2006-01-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/25835 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index d6323f4a695..604da50f74c 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -302,7 +302,8 @@ calculate_G_format (st_parameter_dt *dtp, const fnode *f, /* In case of the two data magnitude ranges, generate E editing, Ew.d[Ee]. */ exp_d = calculate_exp (d); - if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 )) + if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) || + ((m == 0.0) && !(compile_options.allow_std & GFC_STD_F2003))) { newf->format = FMT_E; newf->u.real.w = w; diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 17dfbf65234..96c6d1f617a 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -368,6 +368,7 @@ typedef struct { int warn_std; int allow_std; + int pedantic; int convert; } compile_options_t; diff --git a/libgfortran/runtime/compile_options.c b/libgfortran/runtime/compile_options.c index e2a2ffa4c80..ce5e52a34da 100644 --- a/libgfortran/runtime/compile_options.c +++ b/libgfortran/runtime/compile_options.c @@ -37,13 +37,15 @@ compile_options_t compile_options; /* Prototypes */ -extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4); +extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4); export_proto(set_std); void -set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std) +set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std, + GFC_INTEGER_4 pedantic) { + compile_options.pedantic = pedantic; compile_options.warn_std = warn_std; compile_options.allow_std = allow_std; } @@ -58,6 +60,7 @@ init_compile_options (void) | GFC_STD_F2003 | GFC_STD_LEGACY; compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY; + compile_options.pedantic = 0; } /* Function called by the front-end to tell us the diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 2d3c0689adc..b25cd0c8c16 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -508,6 +508,9 @@ notify_std (int std, const char * message) { int warning; + if (!compile_options.pedantic) + return SUCCESS; + warning = compile_options.warn_std & std; if ((compile_options.allow_std & std) != 0 && !warning) return SUCCESS; |