OSDN Git Service

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