/* Parse and display command line options.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Andy Vaught
#include "tree-inline.h"
#include "gfortran.h"
#include "target.h"
+#include "cpp.h"
gfc_option_t gfc_option;
set_default_std_flags (void)
{
gfc_option.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;
+ | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
+ | GFC_STD_GNU | GFC_STD_LEGACY;
gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
}
/* Get ready for options handling. */
unsigned int
-gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
- const char **argv ATTRIBUTE_UNUSED)
+gfc_init_options (unsigned int argc, const char **argv)
{
gfc_source_file = NULL;
gfc_option.module_dir = NULL;
gfc_option.source_form = FORM_UNKNOWN;
gfc_option.fixed_line_length = 72;
gfc_option.free_line_length = 132;
- gfc_option.max_continue_fixed = 19;
- gfc_option.max_continue_free = 39;
+ gfc_option.max_continue_fixed = 255;
+ gfc_option.max_continue_free = 255;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
gfc_option.max_subrecord_length = 0;
gfc_option.convert = GFC_CONVERT_NATIVE;
gfc_option.record_marker = 0;
- gfc_option.verbose = 0;
+ gfc_option.dump_parse_tree = 0;
gfc_option.warn_aliasing = 0;
gfc_option.warn_ampersand = 0;
/* -fshort-enums can be default on some targets. */
gfc_option.fshort_enums = targetm.default_short_enums ();
+ /* Initialize cpp-related options. */
+ gfc_cpp_init_options(argc, argv);
+
return CL_Fortran;
}
".f03", FORM_FREE}
,
{
+ ".f08", FORM_FREE}
+ ,
+ {
".f", FORM_FIXED}
,
{
if (gfc_option.flag_all_intrinsics)
gfc_option.warn_nonstd_intrinsics = 0;
+ gfc_cpp_post_options ();
+
+/* FIXME: return gfc_cpp_preprocess_only ();
+
+ The return value of this function indicates whether the
+ backend needs to be initialized. On -E, we don't need
+ the backend. However, if we return 'true' here, an
+ ICE occurs. Initializing the backend doesn't hurt much,
+ hence, for now we can live with it as is. */
return false;
}
{
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);
- }
+ gfc_fatal_error ("gfortran: Only one -J option allowed");
gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
strcpy (gfc_option.module_dir, arg);
if (code == N_OPTS)
return 1;
+ if (gfc_cpp_handle_option (scode, arg, value) == 1)
+ return 1;
+
switch (code)
{
default:
gfc_option.warn_line_truncation = value;
break;
+ case OPT_Wreturn_type:
+ warn_return_type = value;
+ break;
+
case OPT_Wsurprising:
gfc_option.warn_surprising = value;
break;
break;
case OPT_fdump_parse_tree:
- gfc_option.verbose = value;
+ gfc_option.dump_parse_tree = value;
break;
case OPT_ffixed_form:
else
gfc_fatal_error ("Unrecognized option to -finit-real: %s",
arg);
- break;
+ break;
case OPT_finit_integer_:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
break;
case OPT_J:
- case OPT_M:
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_trap_option (arg);
break;
case OPT_std_f95:
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
gfc_option.warn_std = GFC_STD_F95_OBS;
+ gfc_option.max_continue_fixed = 19;
+ gfc_option.max_continue_free = 39;
gfc_option.max_identifier_length = 31;
gfc_option.warn_ampersand = 1;
gfc_option.warn_tabs = 0;
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;
- gfc_option.max_continue_fixed = 255;
- gfc_option.max_continue_free = 255;
+ gfc_option.max_identifier_length = 63;
+ gfc_option.warn_ampersand = 1;
+ gfc_option.warn_tabs = 0;
+ break;
+
+ case OPT_std_f2008:
+ gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
+ | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
+ gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
gfc_option.warn_tabs = 0;