From c61819ff0f851ca343362f742f819bb459880eb6 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 16 Dec 2014 21:44:45 +0100 Subject: [PATCH] re PR fortran/54687 (Use gcc option machinery for gfortran) 2014-12-16 Tobias Burnus PR fortran/54687 * gfortran.h (gfc_option_t): Remove flags which now have a Var(). * lang.opt (flag-aggressive_function_elimination, flag-align_commons, flag-all_intrinsics, flag-allow_leading_underscore, flag-automatic, flag-backslash, flag-backtrace, flag-blas_matmul_limit, flag-cray_pointer, flag-dollar_ok, flag-dump_fortran_original, flag-dump_fortran_optimized, flag-external_blas, flag-f2c, flag-implicit_none, flag-max_array_constructor, flag-module_private, flag-pack_derived, flag-range_check, flag-recursive, flag-repack_arrays, flag-sign_zero, flag-underscoring): Add Var() and, where applicable, Enum(). * options.c (gfc_init_options, gfc_post_options, gfc_handle_option): Update for *.opt changes. * arith.c: Update for flag-variable name changes. * array.c: Ditto. * cpp.c: Ditto. * decl.c: Ditto. * expr.c: Ditto. * f95-lang.c: Ditto. * frontend-passes.c: Ditto. * intrinsic.c: Ditto. * io.c: Ditto. * match.c: Ditto. * module.c: Ditto. * parse.c: Ditto. * primary.c: Ditto. * resolve.c: Ditto. * scanner.c: Ditto. * simplify.c: Ditto. * symbol.c: Ditto. * trans-array.c: Ditto. * trans-common.c: Ditto. * trans-decl.c: Ditto. * trans-expr.c: Ditto. * trans-intrinsic.c: Ditto. * trans-openmp.c: Ditto. * trans-types.c: Ditto. From-SVN: r218792 --- gcc/fortran/ChangeLog | 43 ++++++++++ gcc/fortran/arith.c | 18 ++-- gcc/fortran/array.c | 6 +- gcc/fortran/cpp.c | 4 +- gcc/fortran/decl.c | 6 +- gcc/fortran/expr.c | 5 +- gcc/fortran/f95-lang.c | 4 +- gcc/fortran/frontend-passes.c | 4 +- gcc/fortran/gfortran.h | 25 ------ gcc/fortran/intrinsic.c | 5 +- gcc/fortran/io.c | 2 +- gcc/fortran/lang.opt | 48 +++++------ gcc/fortran/match.c | 6 +- gcc/fortran/module.c | 2 +- gcc/fortran/options.c | 153 ++++------------------------------ gcc/fortran/parse.c | 16 ++-- gcc/fortran/primary.c | 4 +- gcc/fortran/resolve.c | 2 +- gcc/fortran/scanner.c | 7 +- gcc/fortran/simplify.c | 14 ++-- gcc/fortran/symbol.c | 4 +- gcc/fortran/trans-array.c | 3 +- gcc/fortran/trans-common.c | 4 +- gcc/fortran/trans-decl.c | 38 ++++----- gcc/fortran/trans-expr.c | 8 +- gcc/fortran/trans-intrinsic.c | 6 +- gcc/fortran/trans-openmp.c | 18 ++-- gcc/fortran/trans-types.c | 8 +- 28 files changed, 168 insertions(+), 295 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 98c5c54c2c7..e6ab2a8f01c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,48 @@ 2014-12-16 Tobias Burnus + PR fortran/54687 + * gfortran.h (gfc_option_t): Remove flags which now + have a Var(). + * lang.opt (flag-aggressive_function_elimination, + flag-align_commons, flag-all_intrinsics, + flag-allow_leading_underscore, flag-automatic, flag-backslash, + flag-backtrace, flag-blas_matmul_limit, flag-cray_pointer, + flag-dollar_ok, flag-dump_fortran_original, + flag-dump_fortran_optimized, flag-external_blas, flag-f2c, + flag-implicit_none, flag-max_array_constructor, + flag-module_private, flag-pack_derived, flag-range_check, + flag-recursive, flag-repack_arrays, flag-sign_zero, + flag-underscoring): Add Var() and, where applicable, Enum(). + * options.c (gfc_init_options, gfc_post_options, + gfc_handle_option): Update for *.opt changes. + * arith.c: Update for flag-variable name changes. + * array.c: Ditto. + * cpp.c: Ditto. + * decl.c: Ditto. + * expr.c: Ditto. + * f95-lang.c: Ditto. + * frontend-passes.c: Ditto. + * intrinsic.c: Ditto. + * io.c: Ditto. + * match.c: Ditto. + * module.c: Ditto. + * parse.c: Ditto. + * primary.c: Ditto. + * resolve.c: Ditto. + * scanner.c: Ditto. + * simplify.c: Ditto. + * symbol.c: Ditto. + * trans-array.c: Ditto. + * trans-common.c: Ditto. + * trans-decl.c: Ditto. + * trans-expr.c: Ditto. + * trans-intrinsic.c: Ditto. + * trans-openmp.c: Ditto. + * trans-types.c: Ditto. + +2014-12-16 Tobias Burnus + + PR fortran/54687 * lang.opt (fsecond-underscore, frecord-marker=8, frecord-marker=4, frealloc-lhs, freal-8-real-16, freal-8-real-10, freal-8-real-4, freal-4-real-16, freal-4-real-10, freal-4-real-8, fprotect-parens, diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index 63945477188..e8a5efe6790 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -301,7 +301,7 @@ gfc_check_integer_range (mpz_t p, int kind) } - if (gfc_option.flag_range_check == 0) + if (flag_range_check == 0) return result; if (mpz_cmp (p, gfc_integer_kinds[i].min_int) < 0 @@ -333,12 +333,12 @@ gfc_check_real_range (mpfr_t p, int kind) if (mpfr_inf_p (p)) { - if (gfc_option.flag_range_check != 0) + if (flag_range_check != 0) retval = ARITH_OVERFLOW; } else if (mpfr_nan_p (p)) { - if (gfc_option.flag_range_check != 0) + if (flag_range_check != 0) retval = ARITH_NAN; } else if (mpfr_sgn (q) == 0) @@ -348,14 +348,14 @@ gfc_check_real_range (mpfr_t p, int kind) } else if (mpfr_cmp (q, gfc_real_kinds[i].huge) > 0) { - if (gfc_option.flag_range_check == 0) + if (flag_range_check == 0) mpfr_set_inf (p, mpfr_sgn (p)); else retval = ARITH_OVERFLOW; } else if (mpfr_cmp (q, gfc_real_kinds[i].subnormal) < 0) { - if (gfc_option.flag_range_check == 0) + if (flag_range_check == 0) { if (mpfr_sgn (p) < 0) { @@ -736,7 +736,7 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp) break; case BT_REAL: - if (mpfr_sgn (op2->value.real) == 0 && gfc_option.flag_range_check == 1) + if (mpfr_sgn (op2->value.real) == 0 && flag_range_check == 1) { rc = ARITH_DIV0; break; @@ -748,7 +748,7 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp) case BT_COMPLEX: if (mpc_cmp_si_si (op2->value.complex, 0, 0) == 0 - && gfc_option.flag_range_check == 1) + && flag_range_check == 1) { rc = ARITH_DIV0; break; @@ -863,7 +863,7 @@ arith_power (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp) int i; i = gfc_validate_kind (BT_INTEGER, result->ts.kind, false); - if (gfc_option.flag_range_check) + if (flag_range_check) rc = ARITH_OVERFLOW; /* Still, we want to give the same value as the @@ -1978,7 +1978,7 @@ gfc_int2int (gfc_expr *src, int kind) /* If we do not trap numeric overflow, we need to convert the number to signed, throwing away high-order bits if necessary. */ - if (gfc_option.flag_range_check == 0) + if (flag_range_check == 0) { int k; diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 300bfebf1fa..e88ba668adb 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" +#include "flags.h" #include "gfortran.h" #include "match.h" #include "constructor.h" @@ -1654,7 +1655,7 @@ gfc_expand_constructor (gfc_expr *e, bool fatal) /* If we can successfully get an array element at the max array size then the array is too big to expand, so we just return. */ - f = gfc_get_array_element (e, gfc_option.flag_max_array_constructor); + f = gfc_get_array_element (e, flag_max_array_constructor); if (f != NULL) { gfc_free_expr (f); @@ -1663,8 +1664,7 @@ gfc_expand_constructor (gfc_expr *e, bool fatal) gfc_error ("The number of elements in the array constructor " "at %L requires an increase of the allowed %d " "upper limit. See %<-fmax-array-constructor%> " - "option", &e->where, - gfc_option.flag_max_array_constructor); + "option", &e->where, flag_max_array_constructor); return false; } return true; diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c index 090e2097496..70f83ee4762 100644 --- a/gcc/fortran/cpp.c +++ b/gcc/fortran/cpp.c @@ -170,7 +170,7 @@ cpp_define_builtins (cpp_reader *pfile) cpp_define (pfile, "__GFORTRAN__=1"); cpp_define (pfile, "_LANGUAGE_FORTRAN=1"); - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) cpp_define (pfile, "_OPENMP=201307"); /* The defines below are necessary for the TARGET_* macros. @@ -470,7 +470,7 @@ gfc_cpp_post_options (void) cpp_option->cpp_pedantic = pedantic; - cpp_option->dollars_in_ident = gfc_option.flag_dollar_ok; + cpp_option->dollars_in_ident = flag_dollar_ok; cpp_option->discard_comments = gfc_cpp_option.discard_comments; cpp_option->discard_comments_in_macro_exp = gfc_cpp_option.discard_comments_in_macro_exp; cpp_option->print_include_names = gfc_cpp_option.print_include_names; diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index fe3e60cce01..8d01c453e89 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1852,7 +1852,7 @@ variable_decl (int elem) goto cleanup; } - if (gfc_option.flag_cray_pointer) + if (flag_cray_pointer) cp_as = gfc_copy_array_spec (as); /* At this point, we know for sure if the symbol is PARAMETER and can thus @@ -1921,7 +1921,7 @@ variable_decl (int elem) /* If this symbol has already shown up in a Cray Pointer declaration, and this is not a component declaration, then we want to set the type & bail out. */ - if (gfc_option.flag_cray_pointer && gfc_current_state () != COMP_DERIVED) + if (flag_cray_pointer && gfc_current_state () != COMP_DERIVED) { gfc_find_symbol (name, gfc_current_ns, 1, &sym); if (sym != NULL && sym->attr.cray_pointee) @@ -6769,7 +6769,7 @@ gfc_match_pointer (void) gfc_gobble_whitespace (); if (gfc_peek_ascii_char () == '(') { - if (!gfc_option.flag_cray_pointer) + if (!flag_cray_pointer) { gfc_error ("Cray pointer declaration at %C requires -fcray-pointer " "flag"); diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5c2a3065eb8..a887d4c5661 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1530,13 +1530,12 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) } limit = mpz_get_ui (ptr); - if (limit >= gfc_option.flag_max_array_constructor) + if (limit >= flag_max_array_constructor) { gfc_error ("The number of elements in the array constructor " "at %L requires an increase of the allowed %d " "upper limit. See -fmax-array-constructor " - "option", &expr->where, - gfc_option.flag_max_array_constructor); + "option", &expr->where, flag_max_array_constructor); return false; } diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 223e9381e69..10542307a35 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -1139,9 +1139,7 @@ gfc_init_builtin_functions (void) #include "../sync-builtins.def" #undef DEF_SYNC_BUILTIN - if (gfc_option.gfc_flag_openmp - || gfc_option.gfc_flag_openmp_simd - || flag_tree_parallelize_loops) + if (flag_openmp || flag_openmp_simd || flag_tree_parallelize_loops) { #undef DEF_GOMP_BUILTIN #define DEF_GOMP_BUILTIN(code, name, type, attr) \ diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 0e2c2088eaf..7d59f2ebd6b 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -108,7 +108,7 @@ gfc_run_passes (gfc_namespace *ns) { optimize_namespace (ns); optimize_reduction (ns); - if (gfc_option.dump_fortran_optimized) + if (flag_dump_fortran_optimized) gfc_dump_parse_tree (ns, stdout); expr_array.release (); @@ -389,7 +389,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED, /* Only eliminate potentially impure functions if the user specifically requested it. */ - if (!gfc_option.flag_aggressive_function_elimination + if (!flag_aggressive_function_elimination && !(*e)->value.function.esym->attr.pure && !(*e)->value.function.esym->attr.implicit_pure) return 0; diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index fb0585b35b1..0f8b2be5965 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2429,42 +2429,17 @@ typedef struct int max_continue_fixed; int max_continue_free; int max_identifier_length; - int dump_fortran_original; - int dump_fortran_optimized; int max_errors; - int flag_all_intrinsics; - int flag_dollar_ok; - int flag_underscoring; - int flag_implicit_none; - int flag_max_array_constructor; - int flag_range_check; - int flag_pack_derived; - int flag_repack_arrays; int flag_preprocessed; - int flag_f2c; - int flag_automatic; - int flag_backslash; - int flag_backtrace; - int flag_allow_leading_underscore; - int flag_external_blas; - int blas_matmul_limit; - int flag_cray_pointer; int flag_d_lines; - int gfc_flag_openmp; - int gfc_flag_openmp_simd; - int flag_sign_zero; - int flag_module_private; - int flag_recursive; int flag_init_integer; int flag_init_integer_value; int flag_init_real; int flag_init_logical; int flag_init_character; char flag_init_character_value; - int flag_align_commons; - int flag_aggressive_function_elimination; int fpe; int fpe_summary; diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index e920a422667..415a7c99206 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4264,7 +4264,7 @@ gfc_check_intrinsic_standard (const gfc_intrinsic_sym* isym, const char* symstd_msg; /* For -fall-intrinsics, just succeed. */ - if (gfc_option.flag_all_intrinsics) + if (flag_all_intrinsics) return true; /* Find the symbol's standard message for later usage. */ @@ -4623,8 +4623,7 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) } else if (wflag) { - if (gfc_option.flag_range_check - && expr->expr_type == EXPR_CONSTANT + if (flag_range_check && expr->expr_type == EXPR_CONSTANT && from_ts.type == ts->type) { /* Do nothing. Constants of the same type are range-checked diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index ef0e59aba13..dca0829eaee 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -157,7 +157,7 @@ next_char (gfc_instring in_string) c = '\0'; } - if (gfc_option.flag_backslash && c == '\\') + if (flag_backslash && c == '\\') { locus old_locus = gfc_current_locus; diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 78b3d590877..1e84c69053e 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -346,35 +346,35 @@ Fortran Joined ; Documented in common.opt faggressive-function-elimination -Fortran +Fortran Var(flag_aggressive_function_elimination) Eliminate multiple function invokations also for impure functions falign-commons -Fortran +Fortran Var(flag_align_commons) Init(1) Enable alignment of COMMON blocks fall-intrinsics -Fortran RejectNegative +Fortran RejectNegative Var(flag_all_intrinsics) All intrinsics procedures are available regardless of selected standard fallow-leading-underscore -Fortran Undocumented +Fortran Undocumented Var(flag_allow_leading_underscore) ; For internal use only: allow the first character of symbol names to be an underscore fautomatic -Fortran +Fortran Var(flag_automatic) Init(1) Do not treat local variables and COMMON blocks as if they were named in SAVE statements fbackslash -Fortran +Fortran Var(flag_backslash) Specify that backslash in string introduces an escape character fbacktrace -Fortran +Fortran Var(flag_backtrace) Init(1) Produce a backtrace when a runtime error is encountered fblas-matmul-limit= -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_blas_matmul_limit) Init(30) -fblas-matmul-limit= Size of the smallest matrix for which matmul will use BLAS fcheck-array-temporaries @@ -398,7 +398,7 @@ Fortran RejectNegative Swap endianness for unformatted files fcray-pointer -Fortran +Fortran Var(flag_cray_pointer) Use the Cray Pointer extension fd-lines-as-code @@ -422,7 +422,7 @@ Fortran Var(flag_default_real) Set the default real kind to an 8 byte wide type fdollar-ok -Fortran +Fortran Var(flag_dollar_ok) Allow dollar signs in entity names fdump-core @@ -430,23 +430,23 @@ Fortran Ignore Does nothing. Preserved for backward compatibility. fdump-fortran-original -Fortran +Fortran Var(flag_dump_fortran_original) Display the code tree after parsing fdump-fortran-optimized -Fortran +Fortran Var(flag_dump_fortran_optimized) Display the code tree after front end optimization fdump-parse-tree -Fortran +Fortran Alias(fdump-fortran-original) Display the code tree after parsing; deprecated option fexternal-blas -Fortran +Fortran Var(flag_external_blas) Specify that an external BLAS library should be used for matmul calls on large-size arrays ff2c -Fortran +Fortran Var(flag_f2c) Use f2c calling convention ffixed-form @@ -498,7 +498,7 @@ Fortran Var(flag_frontend_optimize) Init(-1) Enable front end optimization fimplicit-none -Fortran +Fortran Var(flag_implicit_none) Specify that no implicit typing is allowed, unless overridden by explicit IMPLICIT statements finit-character= @@ -522,7 +522,7 @@ Fortran RejectNegative Joined -finit-real= Initialize local real variables fmax-array-constructor= -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_max_array_constructor) Init(65535) -fmax-array-constructor= Maximum number of objects in an array constructor fmax-identifier-length= @@ -542,7 +542,7 @@ Fortran Var(flag_stack_arrays) Init(-1) Put all local arrays on stack. fmodule-private -Fortran +Fortran Var(flag_module_private) Set default accessibility of module entities to PRIVATE. fopenmp @@ -554,7 +554,7 @@ Fortran ; Documented in C fpack-derived -Fortran +Fortran Var(flag_pack_derived) Try to lay out derived types as compactly as possible fpreprocessed @@ -566,7 +566,7 @@ Fortran Var(flag_protect_parens) Init(-1) Protect parentheses in expressions frange-check -Fortran +Fortran Var(flag_range_check) Init(1) Enable range checking during compilation freal-4-real-8 @@ -606,11 +606,11 @@ Fortran RejectNegative Var(flag_record_marker,8) Use an 8-byte record marker for unformatted files frecursive -Fortran +Fortran Var(flag_recursive) Allocate local variables on the stack to allow indirect recursion frepack-arrays -Fortran +Fortran Var(flag_repack_arrays) Copy array sections into a contiguous block on procedure entry fcoarray= @@ -630,11 +630,11 @@ Fortran Var(flag_short_enums) ; Documented in C fsign-zero -Fortran +Fortran Var(flag_sign_zero) Init(1) Apply negative sign to zero values funderscoring -Fortran +Fortran Var(flag_underscoring) Init(1) Append underscores to externally visible names fwhole-file diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 9e0851351c2..0a2fb0dd95f 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -530,7 +530,7 @@ gfc_match_name (char *buffer) gfc_gobble_whitespace (); c = gfc_next_ascii_char (); - if (!(ISALPHA (c) || (c == '_' && gfc_option.flag_allow_leading_underscore))) + if (!(ISALPHA (c) || (c == '_' && flag_allow_leading_underscore))) { if (!gfc_error_flag_test () && c != '(') gfc_error ("Invalid character in name at %C"); @@ -553,9 +553,9 @@ gfc_match_name (char *buffer) old_loc = gfc_current_locus; c = gfc_next_ascii_char (); } - while (ISALNUM (c) || c == '_' || (gfc_option.flag_dollar_ok && c == '$')); + while (ISALNUM (c) || c == '_' || (flag_dollar_ok && c == '$')); - if (c == '$' && !gfc_option.flag_dollar_ok) + if (c == '$' && !flag_dollar_ok) { gfc_fatal_error ("Invalid character %<$%> at %L. Use %<-fdollar-ok%> to " "allow it as an extension", &old_loc); diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index a3ec1a1e3cf..f6e5eec0a6d 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -5249,7 +5249,7 @@ check_access (gfc_access specific_access, gfc_access default_access) if (specific_access == ACCESS_PRIVATE) return FALSE; - if (gfc_option.flag_module_private) + if (flag_module_private) return default_access == ACCESS_PUBLIC; else return default_access != ACCESS_PRIVATE; diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 5a1be120da0..5dcb5d84b09 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -84,43 +84,17 @@ gfc_init_options (unsigned int decoded_options_count, gfc_option.max_continue_fixed = 255; gfc_option.max_continue_free = 255; gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN; - gfc_option.flag_max_array_constructor = 65535; gfc_option.convert = GFC_CONVERT_NATIVE; - gfc_option.dump_fortran_original = 0; - gfc_option.dump_fortran_optimized = 0; - gfc_option.max_errors = 25; - gfc_option.flag_all_intrinsics = 0; - gfc_option.flag_dollar_ok = 0; - gfc_option.flag_underscoring = 1; - gfc_option.flag_f2c = 0; - gfc_option.flag_implicit_none = 0; - - gfc_option.flag_range_check = 1; - gfc_option.flag_pack_derived = 0; - gfc_option.flag_repack_arrays = 0; gfc_option.flag_preprocessed = 0; - gfc_option.flag_automatic = 1; - gfc_option.flag_backslash = 0; - gfc_option.flag_module_private = 0; - gfc_option.flag_backtrace = 1; - gfc_option.flag_allow_leading_underscore = 0; - gfc_option.flag_external_blas = 0; - gfc_option.blas_matmul_limit = 30; - gfc_option.flag_cray_pointer = 0; gfc_option.flag_d_lines = -1; - gfc_option.gfc_flag_openmp = 0; - gfc_option.flag_sign_zero = 1; - gfc_option.flag_recursive = 0; gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF; gfc_option.flag_init_integer_value = 0; gfc_option.flag_init_real = GFC_INIT_REAL_OFF; gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF; gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF; gfc_option.flag_init_character_value = (char)0; - gfc_option.flag_align_commons = 1; - gfc_option.flag_aggressive_function_elimination = 0; gfc_option.fpe = 0; /* All except GFC_FPE_INEXACT. */ @@ -262,7 +236,7 @@ gfc_post_options (const char **pfilename) gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS; if (flag_compare_debug) - gfc_option.dump_fortran_original = 0; + flag_dump_fortran_original = 0; /* Make -fmax-errors visible to gfortran's diagnostic machinery. */ if (global_options_set.x_flag_max_errors) @@ -347,33 +321,32 @@ gfc_post_options (const char **pfilename) use it if we're trying to be compatible with f2c, and not otherwise. */ if (flag_second_underscore == -1) - flag_second_underscore = gfc_option.flag_f2c; + flag_second_underscore = flag_f2c; - if (!gfc_option.flag_automatic && flag_max_stack_var_size != -2 + if (!flag_automatic && flag_max_stack_var_size != -2 && flag_max_stack_var_size != 0) gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>", flag_max_stack_var_size); - else if (!gfc_option.flag_automatic && gfc_option.flag_recursive) + else if (!flag_automatic && flag_recursive) gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-frecursive%>"); - else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp) + else if (!flag_automatic && flag_openmp) gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by " "%<-fopenmp%>"); - else if (flag_max_stack_var_size != -2 && gfc_option.flag_recursive) + else if (flag_max_stack_var_size != -2 && flag_recursive) gfc_warning_now ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>", flag_max_stack_var_size); - else if (flag_max_stack_var_size != -2 && gfc_option.gfc_flag_openmp) + else if (flag_max_stack_var_size != -2 && flag_openmp) gfc_warning_now ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> " "implied by %<-fopenmp%>", flag_max_stack_var_size); /* Implement -frecursive as -fmax-stack-var-size=-1. */ - if (gfc_option.flag_recursive) + if (flag_recursive) flag_max_stack_var_size = -1; /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */ - if (flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp - && gfc_option.flag_automatic) + if (flag_max_stack_var_size == -2 && flag_openmp && flag_automatic) { - gfc_option.flag_recursive = 1; + flag_recursive = 1; flag_max_stack_var_size = -1; } @@ -382,7 +355,7 @@ gfc_post_options (const char **pfilename) flag_max_stack_var_size = 32768; /* Implement -fno-automatic as -fmax-stack-var-size=0. */ - if (!gfc_option.flag_automatic) + if (!flag_automatic) flag_max_stack_var_size = 0; /* Optimization implies front end optimization, unless the user @@ -391,6 +364,9 @@ gfc_post_options (const char **pfilename) if (flag_frontend_optimize == -1) flag_frontend_optimize = optimize; + if (flag_max_array_constructor < 65535) + flag_max_array_constructor = 65535; + if (flag_fixed_line_length != 0 && flag_fixed_line_length < 7) gfc_fatal_error ("Fixed line length must be at least seven"); @@ -567,50 +543,10 @@ gfc_handle_option (size_t scode, const char *arg, int value, result = false; break; - case OPT_fall_intrinsics: - gfc_option.flag_all_intrinsics = 1; - break; - - case OPT_fautomatic: - gfc_option.flag_automatic = value; - break; - - case OPT_fallow_leading_underscore: - gfc_option.flag_allow_leading_underscore = value; - break; - - case OPT_fbackslash: - gfc_option.flag_backslash = value; - break; - - case OPT_fbacktrace: - gfc_option.flag_backtrace = value; - break; - case OPT_fcheck_array_temporaries: gfc_option.rtcheck |= GFC_RTCHECK_ARRAY_TEMPS; break; - case OPT_fcray_pointer: - gfc_option.flag_cray_pointer = value; - break; - - case OPT_ff2c: - gfc_option.flag_f2c = value; - break; - - case OPT_fdollar_ok: - gfc_option.flag_dollar_ok = value; - break; - - case OPT_fexternal_blas: - gfc_option.flag_external_blas = value; - break; - - case OPT_fblas_matmul_limit_: - gfc_option.blas_matmul_limit = value; - break; - case OPT_fd_lines_as_code: gfc_option.flag_d_lines = 1; break; @@ -619,15 +555,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.flag_d_lines = 0; break; - case OPT_fdump_fortran_original: - case OPT_fdump_parse_tree: - gfc_option.dump_fortran_original = value; - break; - - case OPT_fdump_fortran_optimized: - gfc_option.dump_fortran_optimized = value; - break; - case OPT_ffixed_form: gfc_option.source_form = FORM_FIXED; break; @@ -636,18 +563,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.source_form = FORM_FREE; break; - case OPT_fopenmp: - gfc_option.gfc_flag_openmp = value; - break; - - case OPT_fopenmp_simd: - gfc_option.gfc_flag_openmp_simd = value; - break; - - case OPT_funderscoring: - gfc_option.flag_underscoring = value; - break; - case OPT_static_libgfortran: #ifndef HAVE_LD_STATIC_DYNAMIC gfc_fatal_error ("%<-static-libgfortran%> is not supported in this " @@ -655,10 +570,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, #endif break; - case OPT_fimplicit_none: - gfc_option.flag_implicit_none = value; - break; - case OPT_fintrinsic_modules_path: case OPT_fintrinsic_modules_path_: @@ -671,26 +582,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_add_intrinsic_modules_path (arg); break; - case OPT_fmax_array_constructor_: - gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535; - break; - - case OPT_fmodule_private: - gfc_option.flag_module_private = value; - break; - - case OPT_frange_check: - gfc_option.flag_range_check = value; - break; - - case OPT_fpack_derived: - gfc_option.flag_pack_derived = value; - break; - - case OPT_frepack_arrays: - gfc_option.flag_repack_arrays = value; - break; - case OPT_fpreprocessed: gfc_option.flag_preprocessed = value; break; @@ -761,10 +652,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_handle_module_path_options (arg); break; - case OPT_fsign_zero: - gfc_option.flag_sign_zero = value; - break; - case OPT_ffpe_trap_: gfc_handle_fpe_option (arg, true); break; @@ -841,18 +728,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.convert = GFC_CONVERT_SWAP; break; - case OPT_frecursive: - gfc_option.flag_recursive = value; - break; - - case OPT_falign_commons: - gfc_option.flag_align_commons = value; - break; - - case OPT_faggressive_function_elimination: - gfc_option.flag_aggressive_function_elimination = value; - break; - case OPT_fcheck_: gfc_handle_runtime_check_option (arg); break; diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 54c0cdc13fa..b4fa61ea092 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include #include "coretypes.h" +#include "flags.h" #include "gfortran.h" #include "match.h" #include "parse.h" @@ -574,7 +575,7 @@ decode_statement (void) /* Like match, but don't match anything if not -fopenmp. */ #define matcho(keyword, subr, st) \ do { \ - if (!gfc_option.gfc_flag_openmp) \ + if (!flag_openmp) \ ; \ else if (match_word (keyword, subr, &old_locus) \ == MATCH_YES) \ @@ -769,7 +770,7 @@ decode_omp_directive (void) not -fopenmp and simd_matched is false, i.e. if a directive other than one marked with match has been seen. */ - if (gfc_option.gfc_flag_openmp || simd_matched) + if (flag_openmp || simd_matched) { if (!gfc_error_check ()) gfc_error_now ("Unclassifiable OpenMP directive at %C"); @@ -896,9 +897,7 @@ next_free (void) return decode_gcc_attribute (); } - else if (c == '$' - && (gfc_option.gfc_flag_openmp - || gfc_option.gfc_flag_openmp_simd)) + else if (c == '$' && (flag_openmp || flag_openmp_simd)) { int i; @@ -988,8 +987,7 @@ next_fixed (void) return decode_gcc_attribute (); } else if (c == '$' - && (gfc_option.gfc_flag_openmp - || gfc_option.gfc_flag_openmp_simd)) + && (flag_openmp || flag_openmp_simd)) { for (i = 0; i < 4; i++, c = gfc_next_char_literal (NONSTRING)) gcc_assert ((char) gfc_wide_tolower (c) == "$omp"[i]); @@ -5085,7 +5083,7 @@ loop: gfc_resolve (gfc_current_ns); /* Dump the parse tree if requested. */ - if (gfc_option.dump_fortran_original) + if (flag_dump_fortran_original) gfc_dump_parse_tree (gfc_current_ns, stdout); gfc_get_errors (NULL, &errors); @@ -5132,7 +5130,7 @@ prog_units: /* Do the parse tree dump. */ gfc_current_ns - = gfc_option.dump_fortran_original ? gfc_global_ns_list : NULL; + = flag_dump_fortran_original ? gfc_global_ns_list : NULL; for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) if (!gfc_current_ns->proc_name diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 337f5f67b88..77522e54bf0 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -857,7 +857,7 @@ next_string_char (gfc_char_t delimiter, int *ret) return 0; } - if (gfc_option.flag_backslash && c == '\\') + if (flag_backslash && c == '\\') { old_locus = gfc_current_locus; @@ -929,7 +929,7 @@ match_charkind_name (char *name) if (!ISALNUM (c) && c != '_' - && (c != '$' || !gfc_option.flag_dollar_ok)) + && (c != '$' || !flag_dollar_ok)) break; *name++ = c; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ee48a6a06cc..7ee0bab00be 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1558,7 +1558,7 @@ is_illegal_recursion (gfc_symbol* sym, gfc_namespace* context) proc_sym = sym; /* If sym is RECURSIVE, all is well of course. */ - if (proc_sym->attr.recursive || gfc_option.flag_recursive) + if (proc_sym->attr.recursive || flag_recursive) return false; /* Find the context procedure's "real" symbol if it has entries. diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 7a9f62695aa..d6b9bbfc3b7 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -749,8 +749,7 @@ skip_free_comments (void) 2) handle OpenMP conditional compilation, where !$ should be treated as 2 spaces (for initial lines only if followed by space). */ - if ((gfc_option.gfc_flag_openmp - || gfc_option.gfc_flag_openmp_simd) && at_bol) + if ((flag_openmp || flag_openmp_simd) && at_bol) { locus old_loc = gfc_current_locus; if (next_char () == '$') @@ -876,7 +875,7 @@ skip_fixed_comments (void) && continue_line < gfc_linebuf_linenum (gfc_current_locus.lb)) continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); - if (gfc_option.gfc_flag_openmp || gfc_option.gfc_flag_openmp_simd) + if (flag_openmp || flag_openmp_simd) { if (next_char () == '$') { @@ -1822,7 +1821,7 @@ include_line (gfc_char_t *line) c = line; - if (gfc_option.gfc_flag_openmp || gfc_option.gfc_flag_openmp_simd) + if (flag_openmp || flag_openmp_simd) { if (gfc_current_form == FORM_FREE) { diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 32d44ca5036..26eb2e577bc 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -153,7 +153,7 @@ convert_mpz_to_unsigned (mpz_t x, int bitsize) { /* Confirm that no bits above the signed range are unset if we are doing range checking. */ - if (gfc_option.flag_range_check != 0) + if (flag_range_check != 0) gcc_assert (mpz_scan0 (x, bitsize-1) == ULONG_MAX); mpz_init_set_ui (mask, 1); @@ -184,7 +184,7 @@ gfc_convert_mpz_to_signed (mpz_t x, int bitsize) /* Confirm that no bits above the unsigned range are set if we are doing range checking. */ - if (gfc_option.flag_range_check != 0) + if (flag_range_check != 0) gcc_assert (mpz_scan1 (x, bitsize) == ULONG_MAX); if (mpz_tstbit (x, bitsize - 1) == 1) @@ -1261,7 +1261,7 @@ gfc_simplify_bessel_n2 (gfc_expr *order1, gfc_expr *order2, gfc_expr *x, if (mpfr_cmp_ui (x->value.real, 0.0) == 0) { - if (!jn && gfc_option.flag_range_check) + if (!jn && flag_range_check) { gfc_error ("Result of BESSEL_YN is -INF at %L", &result->where); gfc_free_expr (result); @@ -1367,7 +1367,7 @@ gfc_simplify_bessel_n2 (gfc_expr *order1, gfc_expr *order2, gfc_expr *x, /* Special case: For YN, if the previous N gave -INF, set also N+1 to -INF. */ - if (!jn && !gfc_option.flag_range_check && mpfr_inf_p (last2)) + if (!jn && !flag_range_check && mpfr_inf_p (last2)) { mpfr_set_inf (e->value.real, -1); gfc_constructor_append_expr (&result->value.constructor, e, @@ -4475,7 +4475,7 @@ gfc_simplify_nearest (gfc_expr *x, gfc_expr *s) /* Only NaN can occur. Do not use range check as it gives an error for denormal numbers. */ - if (mpfr_nan_p (result->value.real) && gfc_option.flag_range_check) + if (mpfr_nan_p (result->value.real) && flag_range_check) { gfc_error ("Result of NEAREST is NaN at %L", &result->where); gfc_free_expr (result); @@ -5920,7 +5920,7 @@ gfc_simplify_sign (gfc_expr *x, gfc_expr *y) break; case BT_REAL: - if (gfc_option.flag_sign_zero) + if (flag_sign_zero) mpfr_copysign (result->value.real, x->value.real, y->value.real, GFC_RND_MODE); else @@ -6090,7 +6090,7 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp else mpz_init_set_ui (size, 1); - if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor) + if (mpz_get_si (size)*ncopies > flag_max_array_constructor) return NULL; if (source->expr_type == EXPR_CONSTANT) diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index a39d4140b4a..088fbbde6a1 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -220,7 +220,7 @@ gfc_get_default_type (const char *name, gfc_namespace *ns) letter = name[0]; - if (gfc_option.flag_allow_leading_underscore && letter == '_') + if (flag_allow_leading_underscore && letter == '_') gfc_fatal_error ("Option %<-fallow-leading-underscore%> is for use only by " "gfortran developers, and should not be used for " "implicitly typed variables"); @@ -2372,7 +2372,7 @@ gfc_get_namespace (gfc_namespace *parent, int parent_types) continue; } - if (gfc_option.flag_implicit_none != 0) + if (flag_implicit_none != 0) { gfc_clear_ts (ts); continue; diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index d637b5b6a3c..8f0baa62fcd 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -5430,8 +5430,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) "constructor at %L requires an increase of " "the allowed %d upper limit. See " "%<-fmax-array-constructor%> option", - &expr->where, - gfc_option.flag_max_array_constructor); + &expr->where, flag_max_array_constructor); return NULL_TREE; } if (mpz_cmp_si (c->offset, 0) != 0) diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index 3043c61dd88..a7ae714721d 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -254,7 +254,7 @@ gfc_sym_mangled_common_id (gfc_common_head *com) if (strcmp (name, BLANK_COMMON_NAME) == 0) return get_identifier (name); - if (gfc_option.flag_underscoring) + if (flag_underscoring) { has_underscore = strchr (name, '_') != 0; if (flag_second_underscore && has_underscore) @@ -1125,7 +1125,7 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list) "extension to COMMON %qs at %L", sym->name, common->name, &common->where); - if (gfc_option.flag_align_commons) + if (flag_align_commons) offset = align_segment (&align); if (offset) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index e3895acc195..f6286d4c509 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -393,7 +393,7 @@ gfc_sym_mangled_function_id (gfc_symbol * sym) if (sym->attr.proc == PROC_INTRINSIC) return get_identifier (sym->name); - if (gfc_option.flag_underscoring) + if (flag_underscoring) { has_underscore = strchr (sym->name, '_') != 0; if (flag_second_underscore && has_underscore) @@ -1013,7 +1013,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy) /* Even when -frepack-arrays is used, symbols with TARGET attribute are not repacked. */ - if (!gfc_option.flag_repack_arrays || sym->attr.target) + if (!flag_repack_arrays || sym->attr.target) { if (as->type == AS_ASSUMED_SIZE) packed = PACKED_FULL; @@ -1838,7 +1838,7 @@ module_sym: } } - if (gfc_option.flag_f2c + if (flag_f2c && ((e.ts.type == BT_REAL && e.ts.kind == gfc_default_real_kind) || e.ts.type == BT_COMPLEX)) { @@ -1958,7 +1958,7 @@ build_function_decl (gfc_symbol * sym, bool global) if (sym->attr.access == ACCESS_UNKNOWN && sym->module && (sym->ns->default_access == ACCESS_PRIVATE || (sym->ns->default_access == ACCESS_UNKNOWN - && gfc_option.flag_module_private))) + && flag_module_private))) sym->attr.access = ACCESS_PRIVATE; if (!current_function_decl @@ -3158,32 +3158,28 @@ gfc_build_intrinsic_function_decls (void) gfor_fndecl_sgemm = gfc_build_library_function_decl (get_identifier - (gfc_option.flag_underscoring ? "sgemm_" - : "sgemm"), + (flag_underscoring ? "sgemm_" : "sgemm"), void_type_node, 15, pchar_type_node, pchar_type_node, pint, pint, pint, ps, ps, pint, ps, pint, ps, ps, pint, integer_type_node, integer_type_node); gfor_fndecl_dgemm = gfc_build_library_function_decl (get_identifier - (gfc_option.flag_underscoring ? "dgemm_" - : "dgemm"), + (flag_underscoring ? "dgemm_" : "dgemm"), void_type_node, 15, pchar_type_node, pchar_type_node, pint, pint, pint, pd, pd, pint, pd, pint, pd, pd, pint, integer_type_node, integer_type_node); gfor_fndecl_cgemm = gfc_build_library_function_decl (get_identifier - (gfc_option.flag_underscoring ? "cgemm_" - : "cgemm"), + (flag_underscoring ? "cgemm_" : "cgemm"), void_type_node, 15, pchar_type_node, pchar_type_node, pint, pint, pint, pc, pc, pint, pc, pint, pc, pc, pint, integer_type_node, integer_type_node); gfor_fndecl_zgemm = gfc_build_library_function_decl (get_identifier - (gfc_option.flag_underscoring ? "zgemm_" - : "zgemm"), + (flag_underscoring ? "zgemm_" : "zgemm"), void_type_node, 15, pchar_type_node, pchar_type_node, pint, pint, pint, pz, pz, pint, pz, pint, pz, pz, pint, integer_type_node, @@ -3845,8 +3841,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl, block); } else - gcc_assert (gfc_option.flag_f2c - && proc_sym->ts.type == BT_COMPLEX); + gcc_assert (flag_f2c && proc_sym->ts.type == BT_COMPLEX); } /* Initialize the INTENT(OUT) derived type dummy arguments. This @@ -4426,7 +4421,7 @@ gfc_create_module_variable (gfc_symbol * sym) && (sym->attr.access == ACCESS_UNKNOWN && (sym->ns->default_access == ACCESS_PRIVATE || (sym->ns->default_access == ACCESS_UNKNOWN - && gfc_option.flag_module_private)))) + && flag_module_private)))) sym->attr.access = ACCESS_PRIVATE; if (warn_unused_variable && !sym->attr.referenced @@ -5425,11 +5420,9 @@ create_main_function (tree fndecl) build_int_cst (integer_type_node, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, - build_int_cst (integer_type_node, - gfc_option.flag_backtrace)); + build_int_cst (integer_type_node, flag_backtrace)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, - build_int_cst (integer_type_node, - gfc_option.flag_sign_zero)); + build_int_cst (integer_type_node, flag_sign_zero)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, (gfc_option.rtcheck @@ -5727,8 +5720,7 @@ gfc_generate_function_code (gfc_namespace * ns) || (sym->attr.entry_master && sym->ns->entries->sym->attr.recursive); if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) - && !is_recursive - && !gfc_option.flag_recursive) + && !is_recursive && !flag_recursive) { char * msg; @@ -5826,9 +5818,7 @@ gfc_generate_function_code (gfc_namespace * ns) /* Reset recursion-check variable. */ if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) - && !is_recursive - && !gfc_option.gfc_flag_openmp - && recurcheckvar != NULL_TREE) + && !is_recursive && !flag_openmp && recurcheckvar != NULL_TREE) { gfc_add_modify (&cleanup, recurcheckvar, boolean_false_node); recurcheckvar = NULL; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 143decc9489..39cfb2f7e4e 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2056,7 +2056,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) se->expr); /* Dereference scalar hidden result. */ - if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX + if (flag_f2c && sym->ts.type == BT_COMPLEX && (sym->attr.function || sym->attr.result) && !sym->attr.dimension && !sym->attr.pointer && !sym->attr.always_explicit) @@ -5301,7 +5301,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, } else { - gcc_assert (gfc_option.flag_f2c && ts.type == BT_COMPLEX); + gcc_assert (flag_f2c && ts.type == BT_COMPLEX); type = gfc_get_complex_type (ts.kind); var = gfc_build_addr_expr (NULL_TREE, gfc_create_var (type, "cmplx")); @@ -5382,7 +5382,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, return a double precision result. Convert this back to default real. We only care about the cases that can happen in Fortran 77. */ - if (gfc_option.flag_f2c && sym->ts.type == BT_REAL + if (flag_f2c && sym->ts.type == BT_REAL && sym->ts.kind == gfc_default_real_kind && !sym->attr.always_explicit) se->expr = fold_convert (gfc_get_real_type (sym->ts.kind), se->expr); @@ -5433,7 +5433,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, } else { - gcc_assert (ts.type == BT_COMPLEX && gfc_option.flag_f2c); + gcc_assert (ts.type == BT_COMPLEX && flag_f2c); se->expr = build_fold_indirect_ref_loc (input_location, var); } } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index bd3962ecf71..8fefe308bc3 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2470,7 +2470,7 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr) /* We explicitly have to ignore the minus sign. We do so by using result = (arg1 == 0) ? abs(arg0) : copysign(arg0, arg1). */ - if (!gfc_option.flag_sign_zero + if (!flag_sign_zero && MODE_HAS_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (args[1])))) { tree cond, zero; @@ -2978,7 +2978,7 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr) { tree cint = gfc_get_int_type (gfc_c_int_kind); - if (gfc_option.flag_external_blas + if (flag_external_blas && (sym->ts.type == BT_REAL || sym->ts.type == BT_COMPLEX) && (sym->ts.kind == 4 || sym->ts.kind == 8)) { @@ -3002,7 +3002,7 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr) vec_alloc (append_args, 3); append_args->quick_push (build_int_cst (cint, 1)); append_args->quick_push (build_int_cst (cint, - gfc_option.blas_matmul_limit)); + flag_blas_matmul_limit)); append_args->quick_push (gfc_build_addr_expr (NULL_TREE, gemm_fndecl)); } diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index c7edcadfe7a..707a08970ee 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -3435,7 +3435,7 @@ gfc_trans_omp_do_simd (gfc_code *code, stmtblock_t *pblock, clausesa = clausesa_buf; gfc_split_omp_clauses (code, clausesa); } - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) omp_do_clauses = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_DO], code->loc); body = gfc_trans_omp_do (code, EXEC_OMP_SIMD, pblock ? pblock : &block, @@ -3449,7 +3449,7 @@ gfc_trans_omp_do_simd (gfc_code *code, stmtblock_t *pblock, } else if (TREE_CODE (body) != BIND_EXPR) body = build3_v (BIND_EXPR, NULL, body, NULL_TREE); - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) { stmt = make_node (OMP_FOR); TREE_TYPE (stmt) = void_type_node; @@ -3527,7 +3527,7 @@ gfc_trans_omp_parallel_do_simd (gfc_code *code, stmtblock_t *pblock, clausesa = clausesa_buf; gfc_split_omp_clauses (code, clausesa); } - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) omp_clauses = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_PARALLEL], code->loc); @@ -3543,7 +3543,7 @@ gfc_trans_omp_parallel_do_simd (gfc_code *code, stmtblock_t *pblock, } else if (TREE_CODE (stmt) != BIND_EXPR) stmt = build3_v (BIND_EXPR, NULL, stmt, NULL_TREE); - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) { stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt, omp_clauses); @@ -3698,7 +3698,7 @@ gfc_trans_omp_distribute (gfc_code *code, gfc_omp_clauses *clausesa) clausesa = clausesa_buf; gfc_split_omp_clauses (code, clausesa); } - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) omp_clauses = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_DISTRIBUTE], code->loc); @@ -3741,7 +3741,7 @@ gfc_trans_omp_distribute (gfc_code *code, gfc_omp_clauses *clausesa) default: gcc_unreachable (); } - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) { tree distribute = make_node (OMP_DISTRIBUTE); TREE_TYPE (distribute) = void_type_node; @@ -3766,7 +3766,7 @@ gfc_trans_omp_teams (gfc_code *code, gfc_omp_clauses *clausesa) clausesa = clausesa_buf; gfc_split_omp_clauses (code, clausesa); } - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) omp_clauses = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TEAMS], code->loc); @@ -3801,7 +3801,7 @@ gfc_trans_omp_target (gfc_code *code) gfc_start_block (&block); gfc_split_omp_clauses (code, clausesa); - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) omp_clauses = gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TARGET], code->loc); @@ -3811,7 +3811,7 @@ gfc_trans_omp_target (gfc_code *code) stmt = gfc_trans_omp_teams (code, clausesa); if (TREE_CODE (stmt) != BIND_EXPR) stmt = build3_v (BIND_EXPR, NULL, stmt, NULL_TREE); - if (gfc_option.gfc_flag_openmp) + if (flag_openmp) stmt = build2_loc (input_location, OMP_TARGET, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 304b027da4b..07593e55bcb 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2447,7 +2447,7 @@ gfc_get_derived_type (gfc_symbol * derived) /* We see this derived type first time, so build the type node. */ typenode = make_node (RECORD_TYPE); TYPE_NAME (typenode) = get_identifier (derived->name); - TYPE_PACKED (typenode) = gfc_option.flag_pack_derived; + TYPE_PACKED (typenode) = flag_pack_derived; derived->backend_decl = typenode; } @@ -2630,8 +2630,7 @@ gfc_return_by_reference (gfc_symbol * sym) -fno-f2c calling convention), nor for calls to functions which always require an explicit interface, as no compatibility problems can arise there. */ - if (gfc_option.flag_f2c - && sym->ts.type == BT_COMPLEX + if (flag_f2c && sym->ts.type == BT_COMPLEX && !sym->attr.intrinsic && !sym->attr.always_explicit) return 1; @@ -2865,8 +2864,7 @@ arg_type_list_done: type = void_type_node; else if (sym->attr.mixed_entry_master) type = gfc_get_mixed_entry_union (sym->ns); - else if (gfc_option.flag_f2c - && sym->ts.type == BT_REAL + else if (flag_f2c && sym->ts.type == BT_REAL && sym->ts.kind == gfc_default_real_kind && !sym->attr.always_explicit) { -- 2.30.2