OSDN Git Service

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