OSDN Git Service

2008-07-24 Daniel Kraft <d@domob.eu>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / options.c
1 /* Parse and display command line options.
2    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3    Free Software Foundation, Inc.
4    Contributed by Andy Vaught
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tree.h"
26 #include "flags.h"
27 #include "intl.h"
28 #include "opts.h"
29 #include "options.h"
30 #include "params.h"
31 #include "tree-inline.h"
32 #include "gfortran.h"
33 #include "target.h"
34 #include "cpp.h"
35
36 gfc_option_t gfc_option;
37
38
39 /* Set flags that control warnings and errors for different
40    Fortran standards to their default values.  */
41
42 static void
43 set_default_std_flags (void)
44 {
45   gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
46     | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
47     | GFC_STD_GNU | GFC_STD_LEGACY;
48   gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
49 }
50
51 /* Get ready for options handling.  */
52
53 unsigned int
54 gfc_init_options (unsigned int argc, const char **argv)
55 {
56   gfc_source_file = NULL;
57   gfc_option.module_dir = NULL;
58   gfc_option.source_form = FORM_UNKNOWN;
59   gfc_option.fixed_line_length = 72;
60   gfc_option.free_line_length = 132;
61   gfc_option.max_continue_fixed = 255;
62   gfc_option.max_continue_free = 255;
63   gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
64   gfc_option.max_subrecord_length = 0;
65   gfc_option.convert = GFC_CONVERT_NATIVE;
66   gfc_option.record_marker = 0;
67   gfc_option.dump_parse_tree = 0;
68
69   gfc_option.warn_aliasing = 0;
70   gfc_option.warn_ampersand = 0;
71   gfc_option.warn_character_truncation = 0;
72   gfc_option.warn_array_temp = 0;
73   gfc_option.warn_conversion = 0;
74   gfc_option.warn_implicit_interface = 0;
75   gfc_option.warn_line_truncation = 0;
76   gfc_option.warn_surprising = 0;
77   gfc_option.warn_tabs = 1;
78   gfc_option.warn_underflow = 1;
79   gfc_option.warn_intrinsic_shadow = 0;
80   gfc_option.warn_intrinsics_std = 0;
81   gfc_option.max_errors = 25;
82
83   gfc_option.flag_all_intrinsics = 0;
84   gfc_option.flag_default_double = 0;
85   gfc_option.flag_default_integer = 0;
86   gfc_option.flag_default_real = 0;
87   gfc_option.flag_dollar_ok = 0;
88   gfc_option.flag_underscoring = 1;
89   gfc_option.flag_f2c = 0;
90   gfc_option.flag_second_underscore = -1;
91   gfc_option.flag_implicit_none = 0;
92
93   /* Default value of flag_max_stack_var_size is set in gfc_post_options.  */
94   gfc_option.flag_max_stack_var_size = -2;
95
96   gfc_option.flag_range_check = 1;
97   gfc_option.flag_pack_derived = 0;
98   gfc_option.flag_repack_arrays = 0;
99   gfc_option.flag_preprocessed = 0;
100   gfc_option.flag_automatic = 1;
101   gfc_option.flag_backslash = 0;
102   gfc_option.flag_module_private = 0;
103   gfc_option.flag_backtrace = 0;
104   gfc_option.flag_allow_leading_underscore = 0;
105   gfc_option.flag_dump_core = 0;
106   gfc_option.flag_external_blas = 0;
107   gfc_option.blas_matmul_limit = 30;
108   gfc_option.flag_cray_pointer = 0;
109   gfc_option.flag_d_lines = -1;
110   gfc_option.flag_openmp = 0;
111   gfc_option.flag_sign_zero = 1;
112   gfc_option.flag_recursive = 0;
113   gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
114   gfc_option.flag_init_integer_value = 0;
115   gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
116   gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
117   gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
118   gfc_option.flag_init_character_value = (char)0;
119   
120   gfc_option.fpe = 0;
121
122   /* Argument pointers cannot point to anything but their argument.  */
123   flag_argument_noalias = 3;
124
125   flag_errno_math = 0;
126
127   set_default_std_flags ();
128
129   /* -fshort-enums can be default on some targets.  */
130   gfc_option.fshort_enums = targetm.default_short_enums ();
131
132   /* Initialize cpp-related options.  */
133   gfc_cpp_init_options(argc, argv);
134
135   return CL_Fortran;
136 }
137
138
139 /* Determine the source form from the filename extension.  We assume
140    case insensitivity.  */
141
142 static gfc_source_form
143 form_from_filename (const char *filename)
144 {
145   static const struct
146   {
147     const char *extension;
148     gfc_source_form form;
149   }
150   exttype[] =
151   {
152     {
153     ".f90", FORM_FREE}
154     ,
155     {
156     ".f95", FORM_FREE}
157     ,
158     {
159     ".f03", FORM_FREE}
160     ,
161     {
162     ".f08", FORM_FREE}
163     ,
164     {
165     ".f", FORM_FIXED}
166     ,
167     {
168     ".for", FORM_FIXED}
169     ,
170     {
171     ".ftn", FORM_FIXED}
172     ,
173     {
174     "", FORM_UNKNOWN}
175   };            /* sentinel value */
176
177   gfc_source_form f_form;
178   const char *fileext;
179   int i;
180
181   /* Find end of file name.  Note, filename is either a NULL pointer or
182      a NUL terminated string.  */
183   i = 0;
184   while (filename[i] != '\0')
185     i++;
186
187   /* Find last period.  */
188   while (i >= 0 && (filename[i] != '.'))
189     i--;
190
191   /* Did we see a file extension?  */
192   if (i < 0)
193     return FORM_UNKNOWN; /* Nope  */
194
195   /* Get file extension and compare it to others.  */
196   fileext = &(filename[i]);
197
198   i = -1;
199   f_form = FORM_UNKNOWN;
200   do
201     {
202       i++;
203       if (strcasecmp (fileext, exttype[i].extension) == 0)
204         {
205           f_form = exttype[i].form;
206           break;
207         }
208     }
209   while (exttype[i].form != FORM_UNKNOWN);
210
211   return f_form;
212 }
213
214
215 /* Finalize commandline options.  */
216
217 bool
218 gfc_post_options (const char **pfilename)
219 {
220   const char *filename = *pfilename, *canon_source_file = NULL;
221   char *source_path;
222   int i;
223
224   /* Issue an error if -fwhole-program was used.  */
225   if (flag_whole_program)
226     gfc_fatal_error ("Option -fwhole-program is not supported for Fortran");
227
228   /* Verify the input file name.  */
229   if (!filename || strcmp (filename, "-") == 0)
230     {
231       filename = "";
232     }
233
234   if (gfc_option.flag_preprocessed)
235     {
236       /* For preprocessed files, if the first tokens are of the form # NUM.
237          handle the directives so we know the original file name.  */
238       gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file);
239       if (gfc_source_file == NULL)
240         gfc_source_file = filename;
241       else
242         *pfilename = gfc_source_file;
243     }
244   else
245     gfc_source_file = filename;
246
247   if (canon_source_file == NULL)
248     canon_source_file = gfc_source_file;
249
250   /* Adds the path where the source file is to the list of include files.  */
251
252   i = strlen (canon_source_file);
253   while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
254     i--;
255
256   if (i != 0)
257     {
258       source_path = (char *) alloca (i + 1);
259       memcpy (source_path, canon_source_file, i);
260       source_path[i] = 0;
261       gfc_add_include_path (source_path, true);
262     }
263   else
264     gfc_add_include_path (".", true);
265
266   if (canon_source_file != gfc_source_file)
267     gfc_free (CONST_CAST (char *, canon_source_file));
268
269   /* Decide which form the file will be read in as.  */
270
271   if (gfc_option.source_form != FORM_UNKNOWN)
272     gfc_current_form = gfc_option.source_form;
273   else
274     {
275       gfc_current_form = form_from_filename (filename);
276
277       if (gfc_current_form == FORM_UNKNOWN)
278         {
279           gfc_current_form = FORM_FREE;
280           gfc_warning_now ("Reading file '%s' as free form", 
281                            (filename[0] == '\0') ? "<stdin>" : filename);
282         }
283     }
284
285   /* If the user specified -fd-lines-as-{code|comments} verify that we're
286      in fixed form.  */
287   if (gfc_current_form == FORM_FREE)
288     {
289       if (gfc_option.flag_d_lines == 0)
290         gfc_warning_now ("'-fd-lines-as-comments' has no effect "
291                          "in free form");
292       else if (gfc_option.flag_d_lines == 1)
293         gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
294     }
295
296   flag_inline_trees = 1;
297
298   /* Use tree inlining.  */
299   if (!flag_no_inline)
300     flag_no_inline = 1;
301   if (flag_inline_functions)
302     flag_inline_trees = 2;
303
304   /* If -pedantic, warn about the use of GNU extensions.  */
305   if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
306     gfc_option.warn_std |= GFC_STD_GNU;
307   /* -std=legacy -pedantic is effectively -std=gnu.  */
308   if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
309     gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
310
311   /* If the user didn't explicitly specify -f(no)-second-underscore we
312      use it if we're trying to be compatible with f2c, and not
313      otherwise.  */
314   if (gfc_option.flag_second_underscore == -1)
315     gfc_option.flag_second_underscore = gfc_option.flag_f2c;
316
317   if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
318       && gfc_option.flag_max_stack_var_size != 0)
319     gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
320                      gfc_option.flag_max_stack_var_size);
321   else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
322     gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
323   else if (!gfc_option.flag_automatic && gfc_option.flag_openmp)
324     gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
325                      "-fopenmp");
326   else if (gfc_option.flag_max_stack_var_size != -2
327            && gfc_option.flag_recursive)
328     gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
329                      gfc_option.flag_max_stack_var_size);
330   else if (gfc_option.flag_max_stack_var_size != -2
331            && gfc_option.flag_openmp)
332     gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
333                      "implied by -fopenmp", 
334                      gfc_option.flag_max_stack_var_size);
335
336   /* Implied -frecursive; implemented as -fmax-stack-var-size=-1.  */
337   if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp)
338     gfc_option.flag_max_stack_var_size = -1;
339
340   /* Set default.  */
341   if (gfc_option.flag_max_stack_var_size == -2)
342     gfc_option.flag_max_stack_var_size = 32768;
343
344   /* Implement -frecursive as -fmax-stack-var-size=-1.  */
345   if (gfc_option.flag_recursive)
346     gfc_option.flag_max_stack_var_size = -1;
347
348   /* Implement -fno-automatic as -fmax-stack-var-size=0.  */
349   if (!gfc_option.flag_automatic)
350     gfc_option.flag_max_stack_var_size = 0;
351   
352   if (pedantic)
353     { 
354       gfc_option.warn_ampersand = 1;
355       gfc_option.warn_tabs = 0;
356     }
357
358   gfc_cpp_post_options ();
359
360 /* FIXME: return gfc_cpp_preprocess_only ();
361
362    The return value of this function indicates whether the
363    backend needs to be initialized. On -E, we don't need
364    the backend. However, if we return 'true' here, an
365    ICE occurs. Initializing the backend doesn't hurt much,
366    hence, for now we can live with it as is.  */
367   return false;
368 }
369
370
371 /* Set the options for -Wall.  */
372
373 static void
374 set_Wall (int setting)
375 {
376   gfc_option.warn_aliasing = setting;
377   gfc_option.warn_ampersand = setting;
378   gfc_option.warn_line_truncation = setting;
379   gfc_option.warn_surprising = setting;
380   gfc_option.warn_tabs = !setting;
381   gfc_option.warn_underflow = setting;
382   gfc_option.warn_intrinsic_shadow = setting;
383   gfc_option.warn_intrinsics_std = setting;
384   gfc_option.warn_character_truncation = setting;
385
386   set_Wunused (setting);
387   warn_return_type = setting;
388   warn_switch = setting;
389
390   /* We save the value of warn_uninitialized, since if they put
391      -Wuninitialized on the command line, we need to generate a
392      warning about not using it without also specifying -O.  */
393   if (setting == 0)
394     warn_uninitialized = 0;
395   else if (warn_uninitialized != 1)
396     warn_uninitialized = 2;
397 }
398
399
400 static void
401 gfc_handle_module_path_options (const char *arg)
402 {
403
404   if (gfc_option.module_dir != NULL)
405     gfc_fatal_error ("gfortran: Only one -J option allowed");
406
407   gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
408   strcpy (gfc_option.module_dir, arg);
409   strcat (gfc_option.module_dir, "/");
410
411   gfc_add_include_path (gfc_option.module_dir, true);
412 }
413
414
415 static void
416 gfc_handle_fpe_trap_option (const char *arg)
417 {
418   int result, pos = 0, n;
419   static const char * const exception[] = { "invalid", "denormal", "zero",
420                                             "overflow", "underflow",
421                                             "precision", NULL };
422   static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
423                                        GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
424                                        GFC_FPE_UNDERFLOW, GFC_FPE_PRECISION,
425                                        0 };
426  
427   while (*arg)
428     {
429       while (*arg == ',')
430         arg++;
431
432       while (arg[pos] && arg[pos] != ',')
433         pos++;
434
435       result = 0;
436       for (n = 0; exception[n] != NULL; n++)
437         {
438           if (exception[n] && strncmp (exception[n], arg, pos) == 0)
439             {
440               gfc_option.fpe |= opt_exception[n];
441               arg += pos;
442               pos = 0;
443               result = 1;
444               break;
445             }
446         }
447       if (!result)
448         gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
449     }
450 }
451
452
453 /* Handle command-line options.  Returns 0 if unrecognized, 1 if
454    recognized and handled.  */
455
456 int
457 gfc_handle_option (size_t scode, const char *arg, int value)
458 {
459   int result = 1;
460   enum opt_code code = (enum opt_code) scode;
461
462   /* Ignore file names.  */
463   if (code == N_OPTS)
464     return 1;
465
466   if (gfc_cpp_handle_option (scode, arg, value) == 1)
467     return 1;
468
469   switch (code)
470     {
471     default:
472       result = 0;
473       break;
474
475     case OPT_Wall:
476       set_Wall (value);
477       break;
478
479     case OPT_Waliasing:
480       gfc_option.warn_aliasing = value;
481       break;
482
483     case OPT_Wampersand:
484       gfc_option.warn_ampersand = value;
485       break;
486
487     case OPT_Warray_temporaries:
488       gfc_option.warn_array_temp = value;
489       break;
490
491     case OPT_Wcharacter_truncation:
492       gfc_option.warn_character_truncation = value;
493       break;
494
495     case OPT_Wconversion:
496       gfc_option.warn_conversion = value;
497       break;
498
499     case OPT_Wimplicit_interface:
500       gfc_option.warn_implicit_interface = value;
501       break;
502
503     case OPT_Wline_truncation:
504       gfc_option.warn_line_truncation = value;
505       break;
506
507     case OPT_Wreturn_type:
508       warn_return_type = value;
509       break;
510
511     case OPT_Wsurprising:
512       gfc_option.warn_surprising = value;
513       break;
514
515     case OPT_Wtabs:
516       gfc_option.warn_tabs = value;
517       break;
518
519     case OPT_Wunderflow:
520       gfc_option.warn_underflow = value;
521       break;
522
523     case OPT_Wintrinsic_shadow:
524       gfc_option.warn_intrinsic_shadow = value;
525       break;
526
527     case OPT_fall_intrinsics:
528       gfc_option.flag_all_intrinsics = 1;
529       break;
530
531     case OPT_fautomatic:
532       gfc_option.flag_automatic = value;
533       break;
534
535     case OPT_fallow_leading_underscore:
536       gfc_option.flag_allow_leading_underscore = value;
537       break;
538       
539     case OPT_fbackslash:
540       gfc_option.flag_backslash = value;
541       break;
542       
543     case OPT_fbacktrace:
544       gfc_option.flag_backtrace = value;
545       break;
546       
547     case OPT_fdump_core:
548       gfc_option.flag_dump_core = value;
549       break;
550
551     case OPT_fcray_pointer:
552       gfc_option.flag_cray_pointer = value;
553       break;
554
555     case OPT_ff2c:
556       gfc_option.flag_f2c = value;
557       break;
558
559     case OPT_fdollar_ok:
560       gfc_option.flag_dollar_ok = value;
561       break;
562
563     case OPT_fexternal_blas:
564       gfc_option.flag_external_blas = value;
565       break;
566
567     case OPT_fblas_matmul_limit_:
568       gfc_option.blas_matmul_limit = value;
569       break;
570
571     case OPT_fd_lines_as_code:
572       gfc_option.flag_d_lines = 1;
573       break;
574
575     case OPT_fd_lines_as_comments:
576       gfc_option.flag_d_lines = 0;
577       break;
578
579     case OPT_fdump_parse_tree:
580       gfc_option.dump_parse_tree = value;
581       break;
582
583     case OPT_ffixed_form:
584       gfc_option.source_form = FORM_FIXED;
585       break;
586
587     case OPT_ffixed_line_length_none:
588       gfc_option.fixed_line_length = 0;
589       break;
590
591     case OPT_ffixed_line_length_:
592       if (value != 0 && value < 7)
593         gfc_fatal_error ("Fixed line length must be at least seven.");
594       gfc_option.fixed_line_length = value;
595       break;
596
597     case OPT_ffree_form:
598       gfc_option.source_form = FORM_FREE;
599       break;
600
601     case OPT_fopenmp:
602       gfc_option.flag_openmp = value;
603       break;
604
605     case OPT_ffree_line_length_none:
606       gfc_option.free_line_length = 0;
607       break;
608
609     case OPT_ffree_line_length_:
610       if (value != 0 && value < 4)
611         gfc_fatal_error ("Free line length must be at least three.");
612       gfc_option.free_line_length = value;
613       break;
614
615     case OPT_funderscoring:
616       gfc_option.flag_underscoring = value;
617       break;
618
619     case OPT_fsecond_underscore:
620       gfc_option.flag_second_underscore = value;
621       break;
622
623     case OPT_static_libgfortran:
624 #ifndef HAVE_LD_STATIC_DYNAMIC
625       gfc_fatal_error ("-static-libgfortran is not supported in this "
626                        "configuration");
627 #endif
628       break;
629
630     case OPT_fimplicit_none:
631       gfc_option.flag_implicit_none = value;
632       break;
633
634     case OPT_fintrinsic_modules_path:
635       gfc_add_include_path (arg, false);
636       gfc_add_intrinsic_modules_path (arg);
637       break;
638
639     case OPT_fmax_errors_:
640       gfc_option.max_errors = value;
641       break;
642
643     case OPT_fmax_stack_var_size_:
644       gfc_option.flag_max_stack_var_size = value;
645       break;
646
647     case OPT_fmodule_private:
648       gfc_option.flag_module_private = value;
649       break;
650       
651     case OPT_frange_check:
652       gfc_option.flag_range_check = value;
653       break;
654
655     case OPT_fpack_derived:
656       gfc_option.flag_pack_derived = value;
657       break;
658
659     case OPT_frepack_arrays:
660       gfc_option.flag_repack_arrays = value;
661       break;
662
663     case OPT_fpreprocessed:
664       gfc_option.flag_preprocessed = value;
665       break;
666
667     case OPT_fmax_identifier_length_:
668       if (value > GFC_MAX_SYMBOL_LEN)
669         gfc_fatal_error ("Maximum supported identifier length is %d",
670                          GFC_MAX_SYMBOL_LEN);
671       gfc_option.max_identifier_length = value;
672       break;
673
674     case OPT_fdefault_integer_8:
675       gfc_option.flag_default_integer = value;
676       break;
677
678     case OPT_fdefault_real_8:
679       gfc_option.flag_default_real = value;
680       break;
681
682     case OPT_fdefault_double_8:
683       gfc_option.flag_default_double = value;
684       break;
685
686     case OPT_finit_local_zero:
687       gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
688       gfc_option.flag_init_integer_value = 0;
689       gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
690       gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
691       gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
692       gfc_option.flag_init_character_value = (char)0;
693       break;
694
695     case OPT_finit_logical_:
696       if (!strcasecmp (arg, "false"))
697         gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
698       else if (!strcasecmp (arg, "true"))
699         gfc_option.flag_init_logical = GFC_INIT_LOGICAL_TRUE;
700       else
701         gfc_fatal_error ("Unrecognized option to -finit-logical: %s",
702                          arg);
703       break;
704
705     case OPT_finit_real_:
706       if (!strcasecmp (arg, "zero"))
707         gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
708       else if (!strcasecmp (arg, "nan"))
709         gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
710       else if (!strcasecmp (arg, "inf"))
711         gfc_option.flag_init_real = GFC_INIT_REAL_INF;
712       else if (!strcasecmp (arg, "-inf"))
713         gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
714       else
715         gfc_fatal_error ("Unrecognized option to -finit-real: %s",
716                          arg);
717       break;
718
719     case OPT_finit_integer_:
720       gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
721       gfc_option.flag_init_integer_value = atoi (arg);
722       break;
723
724     case OPT_finit_character_:
725       if (value >= 0 && value <= 127)
726         {
727           gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
728           gfc_option.flag_init_character_value = (char)value;
729         }
730       else
731         gfc_fatal_error ("The value of n in -finit-character=n must be "
732                          "between 0 and 127");
733       break;
734
735     case OPT_I:
736       gfc_add_include_path (arg, true);
737       break;
738
739     case OPT_J:
740       gfc_handle_module_path_options (arg);
741       break;
742
743     case OPT_fsign_zero:
744       gfc_option.flag_sign_zero = value;
745       break;
746
747     case OPT_ffpe_trap_:
748       gfc_handle_fpe_trap_option (arg);
749       break;
750
751     case OPT_std_f95:
752       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
753       gfc_option.warn_std = GFC_STD_F95_OBS;
754       gfc_option.max_continue_fixed = 19;
755       gfc_option.max_continue_free = 39;
756       gfc_option.max_identifier_length = 31;
757       gfc_option.warn_ampersand = 1;
758       gfc_option.warn_tabs = 0;
759       break;
760
761     case OPT_std_f2003:
762       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 
763         | GFC_STD_F2003 | GFC_STD_F95;
764       gfc_option.warn_std = GFC_STD_F95_OBS;
765       gfc_option.max_identifier_length = 63;
766       gfc_option.warn_ampersand = 1;
767       gfc_option.warn_tabs = 0;
768       break;
769
770     case OPT_std_f2008:
771       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 
772         | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
773       gfc_option.warn_std = GFC_STD_F95_OBS;
774       gfc_option.max_identifier_length = 63;
775       gfc_option.warn_ampersand = 1;
776       gfc_option.warn_tabs = 0;
777       break;
778
779     case OPT_std_gnu:
780       set_default_std_flags ();
781       break;
782
783     case OPT_std_legacy:
784       set_default_std_flags ();
785       gfc_option.warn_std = 0;
786       break;
787
788     case OPT_Wintrinsics_std:
789       gfc_option.warn_intrinsics_std = value;
790       break;
791
792     case OPT_fshort_enums:
793       gfc_option.fshort_enums = 1;
794       break;
795
796     case OPT_fconvert_little_endian:
797       gfc_option.convert = GFC_CONVERT_LITTLE;
798       break;
799
800     case OPT_fconvert_big_endian:
801       gfc_option.convert = GFC_CONVERT_BIG;
802       break;
803
804     case OPT_fconvert_native:
805       gfc_option.convert = GFC_CONVERT_NATIVE;
806       break;
807
808     case OPT_fconvert_swap:
809       gfc_option.convert = GFC_CONVERT_SWAP;
810       break;
811
812     case OPT_frecord_marker_4:
813       gfc_option.record_marker = 4;
814       break;
815
816     case OPT_frecord_marker_8:
817       gfc_option.record_marker = 8;
818       break;
819
820     case OPT_fmax_subrecord_length_:
821       if (value > MAX_SUBRECORD_LENGTH)
822         gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
823                          MAX_SUBRECORD_LENGTH);
824
825       gfc_option.max_subrecord_length = value;
826       break;
827
828     case OPT_frecursive:
829       gfc_option.flag_recursive = 1;
830       break;
831     }
832
833   return result;
834 }