OSDN Git Service

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