2004-05-13 08:41:07 +02:00
|
|
|
/* Parse and display command line options.
|
arith.c, [...]: Update copyright.
* arith.c, array.c, check.c, decl.c, expr.c, f95-lang.c,
gfortran.h, interface.c, intrinsic.c, io.c, iresolve.c,
match.c, matchexp.c, misc.c, module.c, options.c, parse.c,
scanner.c, simplify.c, symbol.c, trans-array.c, trans-expr.c,
trans-io.c, trans-stmt.c, trans.c: Update copyright.
From-SVN: r93830
2005-01-18 13:11:56 +01:00
|
|
|
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
Inc.
|
2004-05-13 08:41:07 +02:00
|
|
|
Contributed by Andy Vaught
|
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
This file is part of GCC.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 2, or (at your option) any later
|
|
|
|
version.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
Make-lang.in, [...]: Update copyright years and boilerplate.
* Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
expr.c, f95-lang.c, gfortran.h, interface.c, intrinsic.c,
intrinsic.h, io.c, iresolve.c, lang-specs.h, match.c, match.h,
matchexp.c, misc.c, module.c, options.c, parse.c, parse.h,
primary.c, resolve.c, scanner.c, simplify.c, st.c, symbol.c,
trans-array.c, trans-array.h, trans-common.c, trans-const.c,
trans-const.h, trans-decl.c, trans-expr.c, trans-intrinsic.c,
trans-io.c, trans-stmt.c, trans-stmt.h, trans-types.c,
trans-types.h, trans.c, trans.h: Update copyright years and
boilerplate.
* data.c: Likewise, also removed two whitespace-only lines.
* gfortranspec.c, lang.opt: Update copyright years.
From-SVN: r81839
2004-05-14 15:00:04 +02:00
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
2005-06-25 02:40:37 +02:00
|
|
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "flags.h"
|
|
|
|
#include "intl.h"
|
|
|
|
#include "opts.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "tree-inline.h"
|
|
|
|
|
|
|
|
#include "gfortran.h"
|
|
|
|
|
|
|
|
gfc_option_t gfc_option;
|
|
|
|
|
|
|
|
|
|
|
|
/* Get ready for options handling. */
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
|
|
|
|
const char **argv ATTRIBUTE_UNUSED)
|
|
|
|
{
|
2005-08-21 17:28:27 +02:00
|
|
|
gfc_source_file = NULL;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.module_dir = NULL;
|
|
|
|
gfc_option.source_form = FORM_UNKNOWN;
|
|
|
|
gfc_option.fixed_line_length = 72;
|
|
|
|
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
|
|
|
|
gfc_option.verbose = 0;
|
|
|
|
|
|
|
|
gfc_option.warn_aliasing = 0;
|
|
|
|
gfc_option.warn_conversion = 0;
|
|
|
|
gfc_option.warn_implicit_interface = 0;
|
|
|
|
gfc_option.warn_line_truncation = 0;
|
invoke.texi: Document -Wunderflow and spell check.
* invoke.texi: Document -Wunderflow and spell check.
* lang.opt: Add Wunderflow.
* gfortran.h (gfc_option_t): Add warn_underflow option.
* options.c (gfc_init_options, set_Wall): Use it.
* primary.c (match_real_constant): Explicitly handle UNDERFLOW.
* arith.c (gfc_arith_uminus, gfc_arith_plus, gfc_arith_minus,
gfc_arith_times, gfc_arith_divide, gfc_arith_power, gfc_real2real,
gfc_real2complex, gfc_complex2real, gfc_complex2complex): Ditto.
* arith.c (common_logarithm): Fix typo in comment.
From-SVN: r82130
2004-05-22 13:03:17 +02:00
|
|
|
gfc_option.warn_underflow = 1;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.warn_surprising = 0;
|
|
|
|
gfc_option.warn_unused_labels = 0;
|
|
|
|
|
gfortran.h (option_t): Change d8, i8, r8 to flag_default_double, flag_default_integer, flag_default_real
* gfortran.h (option_t): Change d8, i8, r8 to flag_default_double,
flag_default_integer, flag_default_real
* invoke.texi: Update documentation
* lang.opt: Remove d8, i8, r8 definitions; Add fdefault-double-8
fdefault-integer-8, and fdefault-real-8 definitions.
* options.c (gfc_init_options): Set option defaults
(gfc_handle_option): Handle command line options.
* trans-types.c (gfc_init_kinds): Use options.
From-SVN: r97221
2005-03-30 02:30:51 +02:00
|
|
|
gfc_option.flag_default_double = 0;
|
|
|
|
gfc_option.flag_default_integer = 0;
|
|
|
|
gfc_option.flag_default_real = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.flag_dollar_ok = 0;
|
|
|
|
gfc_option.flag_underscoring = 1;
|
2005-05-11 00:06:55 +02:00
|
|
|
gfc_option.flag_f2c = 0;
|
|
|
|
gfc_option.flag_second_underscore = -1;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.flag_implicit_none = 0;
|
|
|
|
gfc_option.flag_max_stack_var_size = 32768;
|
|
|
|
gfc_option.flag_module_access_private = 0;
|
|
|
|
gfc_option.flag_no_backend = 0;
|
|
|
|
gfc_option.flag_pack_derived = 0;
|
|
|
|
gfc_option.flag_repack_arrays = 0;
|
2005-08-31 14:31:30 +02:00
|
|
|
gfc_option.flag_automatic = 1;
|
2005-06-20 22:14:20 +02:00
|
|
|
gfc_option.flag_backslash = 1;
|
2005-08-21 17:28:27 +02:00
|
|
|
gfc_option.flag_d_lines = -1;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
gfortran.h (gfc_default_*_kind): Remove prototypes, add extern variable declaration of same name.
* gfortran.h (gfc_default_*_kind): Remove prototypes, add extern
variable declaration of same name.
* arith.c, check.c, decl.c, dump_parse_tree.c, expr.c,
intrinsic.c, io.c, iresolve.c, match.c, options.c, primary.c,
resolve.c, simplify.c, symbol.c, trans-const.c, trans-io.c:
Replace all calls to gfc_default_*_kind with variable accesses.
* trans-types.c: Same as above.
(gfc_default_*_kind_1): Rename to gfc_default_*_kind, remove
static qualifier. Replace all occurences.
(gfc_default_*_kind): Remove functions.
From-SVN: r86662
2004-08-27 16:49:35 +02:00
|
|
|
gfc_option.q_kind = gfc_default_double_kind;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
flag_argument_noalias = 2;
|
2005-01-30 19:34:03 +01:00
|
|
|
flag_errno_math = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
2005-05-31 00:16:08 +02:00
|
|
|
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU
|
|
|
|
| GFC_STD_LEGACY;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
2005-05-31 00:16:08 +02:00
|
|
|
| GFC_STD_F2003 | GFC_STD_LEGACY;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
gfc_option.warn_nonstd_intrinsics = 0;
|
|
|
|
|
2005-09-13 08:24:18 +02:00
|
|
|
return CL_Fortran;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-21 17:28:27 +02:00
|
|
|
/* Determine the source form from the filename extension. We assume
|
|
|
|
case insensitivity. */
|
|
|
|
|
|
|
|
static gfc_source_form
|
|
|
|
form_from_filename (const char *filename)
|
|
|
|
{
|
|
|
|
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const char *extension;
|
|
|
|
gfc_source_form form;
|
|
|
|
}
|
|
|
|
exttype[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
".f90", FORM_FREE}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
".f95", FORM_FREE}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
".f", FORM_FIXED}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
".for", FORM_FIXED}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
"", FORM_UNKNOWN}
|
|
|
|
}; /* sentinel value */
|
|
|
|
|
|
|
|
gfc_source_form f_form;
|
|
|
|
const char *fileext;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Find end of file name. Note, filename is either a NULL pointer or
|
|
|
|
a NUL terminated string. */
|
|
|
|
i = 0;
|
|
|
|
while (filename[i] != '\0')
|
|
|
|
i++;
|
|
|
|
|
|
|
|
/* Find last period. */
|
|
|
|
while (i >= 0 && (filename[i] != '.'))
|
|
|
|
i--;
|
|
|
|
|
|
|
|
/* Did we see a file extension? */
|
|
|
|
if (i < 0)
|
|
|
|
return FORM_UNKNOWN; /* Nope */
|
|
|
|
|
|
|
|
/* Get file extension and compare it to others. */
|
|
|
|
fileext = &(filename[i]);
|
|
|
|
|
|
|
|
i = -1;
|
|
|
|
f_form = FORM_UNKNOWN;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
if (strcasecmp (fileext, exttype[i].extension) == 0)
|
|
|
|
{
|
|
|
|
f_form = exttype[i].form;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (exttype[i].form != FORM_UNKNOWN);
|
|
|
|
|
|
|
|
return f_form;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Finalize commandline options. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
gfc_post_options (const char **pfilename)
|
|
|
|
{
|
|
|
|
const char *filename = *pfilename;
|
|
|
|
|
|
|
|
/* Verify the input file name. */
|
|
|
|
if (!filename || strcmp (filename, "-") == 0)
|
|
|
|
{
|
|
|
|
filename = "";
|
|
|
|
}
|
|
|
|
|
2005-08-21 17:28:27 +02:00
|
|
|
gfc_source_file = filename;
|
|
|
|
|
|
|
|
/* Decide which form the file will be read in as. */
|
|
|
|
|
|
|
|
if (gfc_option.source_form != FORM_UNKNOWN)
|
|
|
|
gfc_current_form = gfc_option.source_form;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gfc_current_form = form_from_filename (filename);
|
|
|
|
|
|
|
|
if (gfc_current_form == FORM_UNKNOWN)
|
|
|
|
{
|
|
|
|
gfc_current_form = FORM_FREE;
|
|
|
|
gfc_warning_now ("Reading file '%s' as free form.",
|
|
|
|
(filename[0] == '\0') ? "<stdin>" : filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the user specified -fd-lines-as-{code|comments} verify that we're
|
|
|
|
in fixed form. */
|
|
|
|
if (gfc_current_form == FORM_FREE)
|
|
|
|
{
|
|
|
|
if (gfc_option.flag_d_lines == 0)
|
|
|
|
gfc_warning_now ("'-fd-lines-as-comments' has no effect "
|
|
|
|
"in free form.");
|
|
|
|
else if (gfc_option.flag_d_lines == 1)
|
|
|
|
gfc_warning_now ("'-fd-lines-as-code' has no effect "
|
|
|
|
"in free form.");
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
flag_inline_trees = 1;
|
|
|
|
|
|
|
|
/* Use tree inlining. */
|
|
|
|
if (!flag_no_inline)
|
|
|
|
flag_no_inline = 1;
|
|
|
|
if (flag_inline_functions)
|
2004-11-24 20:45:32 +01:00
|
|
|
flag_inline_trees = 2;
|
2004-08-01 23:37:21 +02:00
|
|
|
|
|
|
|
/* If -pedantic, warn about the use of GNU extensions. */
|
|
|
|
if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
|
|
|
|
gfc_option.warn_std |= GFC_STD_GNU;
|
2005-05-31 00:16:08 +02:00
|
|
|
/* -std=legacy -pedantic is effectively -std=gnu. */
|
|
|
|
if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
|
|
|
|
gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
|
2004-08-01 23:37:21 +02:00
|
|
|
|
2005-05-11 00:06:55 +02:00
|
|
|
/* If the user didn't explicitly specify -f(no)-second-underscore we
|
|
|
|
use it if we're trying to be compatible with f2c, and not
|
|
|
|
otherwise. */
|
|
|
|
if (gfc_option.flag_second_underscore == -1)
|
|
|
|
gfc_option.flag_second_underscore = gfc_option.flag_f2c;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Set the options for -Wall. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_Wall (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
gfc_option.warn_aliasing = 1;
|
|
|
|
gfc_option.warn_line_truncation = 1;
|
invoke.texi: Document -Wunderflow and spell check.
* invoke.texi: Document -Wunderflow and spell check.
* lang.opt: Add Wunderflow.
* gfortran.h (gfc_option_t): Add warn_underflow option.
* options.c (gfc_init_options, set_Wall): Use it.
* primary.c (match_real_constant): Explicitly handle UNDERFLOW.
* arith.c (gfc_arith_uminus, gfc_arith_plus, gfc_arith_minus,
gfc_arith_times, gfc_arith_divide, gfc_arith_power, gfc_real2real,
gfc_real2complex, gfc_complex2real, gfc_complex2complex): Ditto.
* arith.c (common_logarithm): Fix typo in comment.
From-SVN: r82130
2004-05-22 13:03:17 +02:00
|
|
|
gfc_option.warn_underflow = 1;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.warn_surprising = 1;
|
|
|
|
gfc_option.warn_unused_labels = 1;
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
gfc_option.warn_nonstd_intrinsics = 1;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
set_Wunused (1);
|
|
|
|
warn_return_type = 1;
|
|
|
|
warn_switch = 1;
|
|
|
|
|
|
|
|
/* We save the value of warn_uninitialized, since if they put
|
|
|
|
-Wuninitialized on the command line, we need to generate a
|
|
|
|
warning about not using it without also specifying -O. */
|
|
|
|
|
|
|
|
if (warn_uninitialized != 1)
|
|
|
|
warn_uninitialized = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gfc_handle_module_path_options (const char *arg)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (gfc_option.module_dir != NULL)
|
|
|
|
{
|
|
|
|
gfc_status ("gfortran: Only one -M option allowed\n");
|
|
|
|
exit (3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg == NULL)
|
|
|
|
{
|
|
|
|
gfc_status ("gfortran: Directory required after -M\n");
|
|
|
|
exit (3);
|
|
|
|
}
|
|
|
|
|
2004-05-16 23:10:24 +02:00
|
|
|
gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
|
2004-05-13 08:41:07 +02:00
|
|
|
strcpy (gfc_option.module_dir, arg);
|
|
|
|
strcat (gfc_option.module_dir, "/");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle command-line options. Returns 0 if unrecognized, 1 if
|
|
|
|
recognized and handled. */
|
|
|
|
int
|
|
|
|
gfc_handle_option (size_t scode, const char *arg, int value)
|
|
|
|
{
|
|
|
|
int result = 1;
|
|
|
|
enum opt_code code = (enum opt_code) scode;
|
|
|
|
|
|
|
|
/* Ignore file names. */
|
|
|
|
if (code == N_OPTS)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
result = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wall:
|
|
|
|
set_Wall ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Waliasing:
|
|
|
|
gfc_option.warn_aliasing = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wconversion:
|
|
|
|
gfc_option.warn_conversion = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wimplicit_interface:
|
|
|
|
gfc_option.warn_implicit_interface = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wline_truncation:
|
|
|
|
gfc_option.warn_line_truncation = value;
|
|
|
|
break;
|
|
|
|
|
invoke.texi: Document -Wunderflow and spell check.
* invoke.texi: Document -Wunderflow and spell check.
* lang.opt: Add Wunderflow.
* gfortran.h (gfc_option_t): Add warn_underflow option.
* options.c (gfc_init_options, set_Wall): Use it.
* primary.c (match_real_constant): Explicitly handle UNDERFLOW.
* arith.c (gfc_arith_uminus, gfc_arith_plus, gfc_arith_minus,
gfc_arith_times, gfc_arith_divide, gfc_arith_power, gfc_real2real,
gfc_real2complex, gfc_complex2real, gfc_complex2complex): Ditto.
* arith.c (common_logarithm): Fix typo in comment.
From-SVN: r82130
2004-05-22 13:03:17 +02:00
|
|
|
case OPT_Wunderflow:
|
|
|
|
gfc_option.warn_underflow = value;
|
|
|
|
break;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
case OPT_Wsurprising:
|
|
|
|
gfc_option.warn_surprising = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wunused_labels:
|
|
|
|
gfc_option.warn_unused_labels = value;
|
|
|
|
break;
|
|
|
|
|
2005-05-11 00:06:55 +02:00
|
|
|
case OPT_ff2c:
|
|
|
|
gfc_option.flag_f2c = value;
|
|
|
|
break;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
case OPT_fdollar_ok:
|
|
|
|
gfc_option.flag_dollar_ok = value;
|
|
|
|
break;
|
|
|
|
|
2005-08-31 14:31:30 +02:00
|
|
|
case OPT_fautomatic:
|
|
|
|
gfc_option.flag_automatic = value;
|
|
|
|
break;
|
|
|
|
|
2005-06-20 22:14:20 +02:00
|
|
|
case OPT_fbackslash:
|
|
|
|
gfc_option.flag_backslash = value;
|
|
|
|
break;
|
|
|
|
|
2005-08-21 17:28:27 +02:00
|
|
|
case OPT_fd_lines_as_code:
|
|
|
|
gfc_option.flag_d_lines = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fd_lines_as_comments:
|
|
|
|
gfc_option.flag_d_lines = 0;
|
|
|
|
break;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
case OPT_fdump_parse_tree:
|
|
|
|
gfc_option.verbose = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_ffixed_form:
|
|
|
|
gfc_option.source_form = FORM_FIXED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_ffree_form:
|
|
|
|
gfc_option.source_form = FORM_FREE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_funderscoring:
|
|
|
|
gfc_option.flag_underscoring = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fsecond_underscore:
|
|
|
|
gfc_option.flag_second_underscore = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fimplicit_none:
|
|
|
|
gfc_option.flag_implicit_none = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fmax_stack_var_size_:
|
|
|
|
gfc_option.flag_max_stack_var_size = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fmodule_private:
|
|
|
|
gfc_option.flag_module_access_private = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fno_backend:
|
|
|
|
gfc_option.flag_no_backend = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fpack_derived:
|
|
|
|
gfc_option.flag_pack_derived = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_frepack_arrays:
|
|
|
|
gfc_option.flag_repack_arrays = value;
|
|
|
|
break;
|
|
|
|
|
2004-07-18 15:00:34 +02:00
|
|
|
case OPT_ffixed_line_length_none:
|
|
|
|
gfc_option.fixed_line_length = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
|
2004-07-18 15:00:34 +02:00
|
|
|
case OPT_ffixed_line_length_:
|
|
|
|
if (value != 0 && value < 7)
|
|
|
|
gfc_fatal_error ("Fixed line length must be at least seven.");
|
|
|
|
gfc_option.fixed_line_length = value;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_fmax_identifier_length_:
|
|
|
|
if (value > GFC_MAX_SYMBOL_LEN)
|
|
|
|
gfc_fatal_error ("Maximum supported idenitifier length is %d",
|
|
|
|
GFC_MAX_SYMBOL_LEN);
|
|
|
|
gfc_option.max_identifier_length = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_qkind_:
|
arith.c (gfc_validate_kind): Add may_fail argument; abort if false and we don't validate the kind.
* arith.c (gfc_validate_kind): Add may_fail argument; abort if
false and we don't validate the kind.
(gfc_check_integer_range, gfc_check_real_range): Update to match.
* check.c (kind_check): Likewise.
* decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Likewise.
(match_char_spec, match_logical_spec): Likewise.
* gfortran.h (gfc_validate_kind): Likewise.
* options.c (gfc_handle_option): Likewise.
* primary.c (match_integer_constant, match_real_constant,
match_string_constant, match_logical_constant,
match_const_complex_part): Likewise.
* simplify.c (get_kind, gfc_simplify_bit_size, gfc_simplify_digits,
gfc_simplify_epsilon, gfc_simplify_huge, gfc_simplify_ibclr,
gfc_simplify_ibset, gfc_simplify_ishft, gfc_simplify_ishftc,
gfc_simplify_maxexponent, gfc_simplify_minexponent,
gfc_simplify_nearest, gfc_simplify_not, gfc_simplify_precision,
gfc_simplify_radix, gfc_simplify_range, gfc_simplify_rrspacing,
gfc_simplify_scale, gfc_simplify_spacing, gfc_simplify_tan,
gfc_simplify_tiny): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_aint, gfc_conv_intrinsic_mod,
gfc_conv_intrinsic_minmaxloc, gfc_conv_intrinsic_minmaxval,
prepare_arg_info): Likewise.
From-SVN: r86608
2004-08-26 08:07:52 +02:00
|
|
|
if (gfc_validate_kind (BT_REAL, value, true) < 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_fatal_error ("Argument to -fqkind isn't a valid real kind");
|
|
|
|
gfc_option.q_kind = value;
|
|
|
|
break;
|
|
|
|
|
gfortran.h (option_t): Change d8, i8, r8 to flag_default_double, flag_default_integer, flag_default_real
* gfortran.h (option_t): Change d8, i8, r8 to flag_default_double,
flag_default_integer, flag_default_real
* invoke.texi: Update documentation
* lang.opt: Remove d8, i8, r8 definitions; Add fdefault-double-8
fdefault-integer-8, and fdefault-real-8 definitions.
* options.c (gfc_init_options): Set option defaults
(gfc_handle_option): Handle command line options.
* trans-types.c (gfc_init_kinds): Use options.
From-SVN: r97221
2005-03-30 02:30:51 +02:00
|
|
|
case OPT_fdefault_integer_8:
|
|
|
|
gfc_option.flag_default_integer = value;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
|
gfortran.h (option_t): Change d8, i8, r8 to flag_default_double, flag_default_integer, flag_default_real
* gfortran.h (option_t): Change d8, i8, r8 to flag_default_double,
flag_default_integer, flag_default_real
* invoke.texi: Update documentation
* lang.opt: Remove d8, i8, r8 definitions; Add fdefault-double-8
fdefault-integer-8, and fdefault-real-8 definitions.
* options.c (gfc_init_options): Set option defaults
(gfc_handle_option): Handle command line options.
* trans-types.c (gfc_init_kinds): Use options.
From-SVN: r97221
2005-03-30 02:30:51 +02:00
|
|
|
case OPT_fdefault_real_8:
|
|
|
|
gfc_option.flag_default_real = value;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
|
gfortran.h (option_t): Change d8, i8, r8 to flag_default_double, flag_default_integer, flag_default_real
* gfortran.h (option_t): Change d8, i8, r8 to flag_default_double,
flag_default_integer, flag_default_real
* invoke.texi: Update documentation
* lang.opt: Remove d8, i8, r8 definitions; Add fdefault-double-8
fdefault-integer-8, and fdefault-real-8 definitions.
* options.c (gfc_init_options): Set option defaults
(gfc_handle_option): Handle command line options.
* trans-types.c (gfc_init_kinds): Use options.
From-SVN: r97221
2005-03-30 02:30:51 +02:00
|
|
|
case OPT_fdefault_double_8:
|
|
|
|
gfc_option.flag_default_double = value;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_I:
|
|
|
|
gfc_add_include_path (arg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_J:
|
|
|
|
case OPT_M:
|
|
|
|
gfc_handle_module_path_options (arg);
|
2004-10-09 00:03:36 +02:00
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
case OPT_std_f95:
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.warn_std = GFC_STD_F95_OBS;
|
|
|
|
gfc_option.max_identifier_length = 31;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_std_f2003:
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
|
|
|
|
| GFC_STD_F2003 | GFC_STD_F95;
|
|
|
|
gfc_option.warn_std = GFC_STD_F95_OBS;
|
2004-05-13 08:41:07 +02:00
|
|
|
gfc_option.max_identifier_length = 63;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_std_gnu:
|
|
|
|
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
| GFC_STD_F77 | GFC_STD_F95 | GFC_STD_F2003
|
2005-05-31 00:16:08 +02:00
|
|
|
| GFC_STD_GNU | GFC_STD_LEGACY;
|
|
|
|
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
|
|
|
| GFC_STD_LEGACY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_std_legacy:
|
|
|
|
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
|
|
|
| GFC_STD_F77 | GFC_STD_F95 | GFC_STD_F2003
|
|
|
|
| GFC_STD_GNU | GFC_STD_LEGACY;
|
|
|
|
gfc_option.warn_std = 0;
|
re PR fortran/17590 (Standard conformance should take intrinsics into account.)
2004-10-31 Janne Blomqvist <jblomqvi@cc.hut.fi>
PR fortran/17590
* gfortran.h: Change GFC_STD_* flags to more appropriate
ones. (struct gfc_intrinsic_isym): Add field for standard. (struct
gfc_option_t): Add field for warning about use of nonstandard
intrinsics.
* intrinsic.c (add_sym): Add parameter for standard version, check
this against current standard.
(add_sym_0): Pass standard parameter to add_sym.
(add_sym_1, add_sym_0s, add_sym_1s, add_sym_1m, add_sym_2): Ditto.
(add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s): Ditto.
(add_sym_4, add_sym_4s, add_sym_5, add_sym_5s): Ditto.
(make_generic): Add parameter for standard, check this
against currently selected standard.
(add_functions, add_subroutines): Add parameter to tell which
standard an intrinsic belongs to.
(check_intrinsic_standard): New function.
(gfc_intrinsic_func_interface): Add call to check_intrinsic_standard.
(gfc_intrinsic_sub_interface): Ditto.
* lang.opt: Add Wnonstd-intrinsics option.
* options.c (gfc_init_options): Change to use new GFC_STD_* flags,
init new warning.
(set_Wall): Add warning about nonstd intrinsics.
(gfc_handle_option): Change to use new GFC_STD_* flags,
handle new warning.
* invoke.texi: Update manual to include -Wnonstd-intrinsics.
From-SVN: r89907
2004-10-31 02:24:29 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OPT_Wnonstd_intrinsics:
|
|
|
|
gfc_option.warn_nonstd_intrinsics = 1;
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|