OSDN Git Service

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