]> gcc.gnu.org Git - gcc.git/blame - gcc/fortran/options.c
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header...
[gcc.git] / gcc / fortran / options.c
CommitLineData
6de9cd9a 1/* Parse and display command line options.
edf1eac2 2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
6c7a4dfd 3 Free Software Foundation, Inc.
6de9cd9a
DN
4 Contributed by Andy Vaught
5
9fc4d79b 6This file is part of GCC.
6de9cd9a 7
9fc4d79b
TS
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
d234d788 10Software Foundation; either version 3, or (at your option) any later
9fc4d79b 11version.
6de9cd9a 12
9fc4d79b
TS
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
6de9cd9a
DN
17
18You should have received a copy of the GNU General Public License
d234d788
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
6de9cd9a 21
6de9cd9a
DN
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"
a5320d39 30#include "params.h"
6de9cd9a 31#include "tree-inline.h"
6de9cd9a 32#include "gfortran.h"
25d8f0a2 33#include "target.h"
6de9cd9a
DN
34
35gfc_option_t gfc_option;
36
37
a47eec17
JD
38/* Set flags that control warnings and errors for different
39 Fortran standards to their default values. */
40
41static void
42set_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
6de9cd9a
DN
50/* Get ready for options handling. */
51
52unsigned int
53gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
54 const char **argv ATTRIBUTE_UNUSED)
55{
e0bcf78c 56 gfc_source_file = NULL;
6de9cd9a
DN
57 gfc_option.module_dir = NULL;
58 gfc_option.source_form = FORM_UNKNOWN;
1dde8683
BM
59 gfc_option.fixed_line_length = 72;
60 gfc_option.free_line_length = 132;
5a06474c
JD
61 gfc_option.max_continue_fixed = 19;
62 gfc_option.max_continue_free = 39;
6de9cd9a 63 gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
07b3bbf2 64 gfc_option.max_subrecord_length = 0;
d74b97cc 65 gfc_option.convert = GFC_CONVERT_NATIVE;
07b3bbf2 66 gfc_option.record_marker = 0;
6de9cd9a
DN
67 gfc_option.verbose = 0;
68
69 gfc_option.warn_aliasing = 0;
3fbab549 70 gfc_option.warn_ampersand = 0;
0b30ba3b 71 gfc_option.warn_character_truncation = 0;
6de9cd9a
DN
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;
840bd9f7
SK
76 gfc_option.warn_tabs = 1;
77 gfc_option.warn_underflow = 1;
3f139fcf 78 gfc_option.max_errors = 25;
6de9cd9a 79
a23eec13 80 gfc_option.flag_all_intrinsics = 0;
3ae9eb27
SK
81 gfc_option.flag_default_double = 0;
82 gfc_option.flag_default_integer = 0;
83 gfc_option.flag_default_real = 0;
6de9cd9a
DN
84 gfc_option.flag_dollar_ok = 0;
85 gfc_option.flag_underscoring = 1;
973ff4c0
TS
86 gfc_option.flag_f2c = 0;
87 gfc_option.flag_second_underscore = -1;
6de9cd9a 88 gfc_option.flag_implicit_none = 0;
1e7de83b
AL
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
54554825 93 gfc_option.flag_range_check = 1;
6de9cd9a
DN
94 gfc_option.flag_pack_derived = 0;
95 gfc_option.flag_repack_arrays = 0;
2d7c7df6 96 gfc_option.flag_preprocessed = 0;
ee5426a4 97 gfc_option.flag_automatic = 1;
131c66cd 98 gfc_option.flag_backslash = 1;
654b6073 99 gfc_option.flag_module_private = 0;
868d75db 100 gfc_option.flag_backtrace = 0;
e6472bce 101 gfc_option.flag_allow_leading_underscore = 0;
eedeea04 102 gfc_option.flag_dump_core = 0;
5a0aad31
FXC
103 gfc_option.flag_external_blas = 0;
104 gfc_option.blas_matmul_limit = 30;
83d890b9 105 gfc_option.flag_cray_pointer = 0;
e0bcf78c 106 gfc_option.flag_d_lines = -1;
6c7a4dfd 107 gfc_option.flag_openmp = 0;
68d2e027 108 gfc_option.flag_sign_zero = 1;
1e7de83b 109 gfc_option.flag_recursive = 0;
6de9cd9a 110
944b8b35
FXC
111 gfc_option.fpe = 0;
112
edf1eac2 113 /* Argument pointers cannot point to anything but their argument. */
0698a1d2
TM
114 flag_argument_noalias = 3;
115
61e067cc 116 flag_errno_math = 0;
6de9cd9a 117
a47eec17 118 set_default_std_flags ();
6de9cd9a 119
b7892582
JB
120 gfc_option.warn_nonstd_intrinsics = 0;
121
25d8f0a2
TS
122 /* -fshort-enums can be default on some targets. */
123 gfc_option.fshort_enums = targetm.default_short_enums ();
124
7f26dfa3 125 return CL_Fortran;
6de9cd9a
DN
126}
127
128
e0bcf78c
TS
129/* Determine the source form from the filename extension. We assume
130 case insensitivity. */
131
132static gfc_source_form
133form_from_filename (const char *filename)
134{
e0bcf78c
TS
135 static const struct
136 {
137 const char *extension;
138 gfc_source_form form;
139 }
140 exttype[] =
141 {
142 {
143 ".f90", FORM_FREE}
144 ,
145 {
146 ".f95", FORM_FREE}
147 ,
148 {
7befd5d2
TB
149 ".f03", FORM_FREE}
150 ,
151 {
e0bcf78c
TS
152 ".f", FORM_FIXED}
153 ,
154 {
155 ".for", FORM_FIXED}
156 ,
157 {
158 "", FORM_UNKNOWN}
159 }; /* sentinel value */
160
161 gfc_source_form f_form;
162 const char *fileext;
163 int i;
164
165 /* Find end of file name. Note, filename is either a NULL pointer or
166 a NUL terminated string. */
167 i = 0;
168 while (filename[i] != '\0')
169 i++;
170
171 /* Find last period. */
172 while (i >= 0 && (filename[i] != '.'))
173 i--;
174
175 /* Did we see a file extension? */
176 if (i < 0)
177 return FORM_UNKNOWN; /* Nope */
178
179 /* Get file extension and compare it to others. */
180 fileext = &(filename[i]);
181
182 i = -1;
183 f_form = FORM_UNKNOWN;
184 do
185 {
186 i++;
187 if (strcasecmp (fileext, exttype[i].extension) == 0)
188 {
189 f_form = exttype[i].form;
190 break;
191 }
192 }
193 while (exttype[i].form != FORM_UNKNOWN);
194
195 return f_form;
196}
197
198
6de9cd9a
DN
199/* Finalize commandline options. */
200
201bool
202gfc_post_options (const char **pfilename)
203{
2d7c7df6 204 const char *filename = *pfilename, *canon_source_file = NULL;
b424a572
FXC
205 char *source_path;
206 int i;
6de9cd9a
DN
207
208 /* Verify the input file name. */
209 if (!filename || strcmp (filename, "-") == 0)
210 {
211 filename = "";
212 }
213
2d7c7df6
JJ
214 if (gfc_option.flag_preprocessed)
215 {
216 /* For preprocessed files, if the first tokens are of the form # NUM.
217 handle the directives so we know the original file name. */
218 gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file);
219 if (gfc_source_file == NULL)
220 gfc_source_file = filename;
221 else
222 *pfilename = gfc_source_file;
223 }
224 else
225 gfc_source_file = filename;
226
227 if (canon_source_file == NULL)
228 canon_source_file = gfc_source_file;
e0bcf78c 229
b424a572
FXC
230 /* Adds the path where the source file is to the list of include files. */
231
2d7c7df6
JJ
232 i = strlen (canon_source_file);
233 while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
b424a572 234 i--;
edf1eac2 235
b424a572
FXC
236 if (i != 0)
237 {
238 source_path = alloca (i + 1);
2d7c7df6 239 memcpy (source_path, canon_source_file, i);
b424a572 240 source_path[i] = 0;
31198773 241 gfc_add_include_path (source_path, true);
b424a572
FXC
242 }
243 else
31198773 244 gfc_add_include_path (".", true);
b424a572 245
2d7c7df6 246 if (canon_source_file != gfc_source_file)
68a57691 247 gfc_free (CONST_CAST (canon_source_file));
2d7c7df6 248
e0bcf78c
TS
249 /* Decide which form the file will be read in as. */
250
251 if (gfc_option.source_form != FORM_UNKNOWN)
252 gfc_current_form = gfc_option.source_form;
253 else
254 {
255 gfc_current_form = form_from_filename (filename);
256
257 if (gfc_current_form == FORM_UNKNOWN)
258 {
259 gfc_current_form = FORM_FREE;
e25a0da3 260 gfc_warning_now ("Reading file '%s' as free form",
2d7c7df6 261 (filename[0] == '\0') ? "<stdin>" : filename);
e0bcf78c
TS
262 }
263 }
264
265 /* If the user specified -fd-lines-as-{code|comments} verify that we're
266 in fixed form. */
267 if (gfc_current_form == FORM_FREE)
268 {
269 if (gfc_option.flag_d_lines == 0)
270 gfc_warning_now ("'-fd-lines-as-comments' has no effect "
e25a0da3 271 "in free form");
e0bcf78c 272 else if (gfc_option.flag_d_lines == 1)
edf1eac2 273 gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
e0bcf78c 274 }
6de9cd9a
DN
275
276 flag_inline_trees = 1;
277
278 /* Use tree inlining. */
279 if (!flag_no_inline)
280 flag_no_inline = 1;
281 if (flag_inline_functions)
39afeb1a 282 flag_inline_trees = 2;
fc2d8429
RS
283
284 /* If -pedantic, warn about the use of GNU extensions. */
285 if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
286 gfc_option.warn_std |= GFC_STD_GNU;
c0309c74
RS
287 /* -std=legacy -pedantic is effectively -std=gnu. */
288 if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
289 gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
fc2d8429 290
973ff4c0
TS
291 /* If the user didn't explicitly specify -f(no)-second-underscore we
292 use it if we're trying to be compatible with f2c, and not
293 otherwise. */
294 if (gfc_option.flag_second_underscore == -1)
295 gfc_option.flag_second_underscore = gfc_option.flag_f2c;
296
1e7de83b
AL
297 if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
298 && gfc_option.flag_max_stack_var_size != 0)
299 gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
300 gfc_option.flag_max_stack_var_size);
301 else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
302 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
303 else if (!gfc_option.flag_automatic && gfc_option.flag_openmp)
304 gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
305 "-fopenmp");
306 else if (gfc_option.flag_max_stack_var_size != -2
307 && gfc_option.flag_recursive)
308 gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
309 gfc_option.flag_max_stack_var_size);
310 else if (gfc_option.flag_max_stack_var_size != -2
311 && gfc_option.flag_openmp)
312 gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
313 "implied by -fopenmp",
314 gfc_option.flag_max_stack_var_size);
315
316 /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
317 if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp)
318 gfc_option.flag_max_stack_var_size = -1;
319
320 /* Set default. */
321 if (gfc_option.flag_max_stack_var_size == -2)
322 gfc_option.flag_max_stack_var_size = 32768;
323
324 /* Implement -frecursive as -fmax-stack-var-size=-1. */
325 if (gfc_option.flag_recursive)
326 gfc_option.flag_max_stack_var_size = -1;
327
d05d9ac7
JJ
328 /* Implement -fno-automatic as -fmax-stack-var-size=0. */
329 if (!gfc_option.flag_automatic)
330 gfc_option.flag_max_stack_var_size = 0;
3fbab549
JD
331
332 if (pedantic)
8135cfa8
SK
333 {
334 gfc_option.warn_ampersand = 1;
335 gfc_option.warn_tabs = 0;
336 }
d05d9ac7 337
73a5988f
SK
338 if (gfc_option.flag_all_intrinsics)
339 gfc_option.warn_nonstd_intrinsics = 0;
340
6de9cd9a
DN
341 return false;
342}
343
344
345/* Set the options for -Wall. */
346
347static void
4428e682 348set_Wall (int setting)
6de9cd9a 349{
4428e682
MLI
350 gfc_option.warn_aliasing = setting;
351 gfc_option.warn_ampersand = setting;
352 gfc_option.warn_line_truncation = setting;
353 gfc_option.warn_nonstd_intrinsics = setting;
354 gfc_option.warn_surprising = setting;
355 gfc_option.warn_tabs = !setting;
356 gfc_option.warn_underflow = setting;
357 gfc_option.warn_character_truncation = setting;
358
359 set_Wunused (setting);
360 warn_return_type = setting;
361 warn_switch = setting;
6de9cd9a
DN
362
363 /* We save the value of warn_uninitialized, since if they put
364 -Wuninitialized on the command line, we need to generate a
365 warning about not using it without also specifying -O. */
4428e682
MLI
366 if (setting == 0)
367 warn_uninitialized = 0;
368 else if (warn_uninitialized != 1)
6de9cd9a
DN
369 warn_uninitialized = 2;
370}
371
372
373static void
374gfc_handle_module_path_options (const char *arg)
375{
376
377 if (gfc_option.module_dir != NULL)
378 {
379 gfc_status ("gfortran: Only one -M option allowed\n");
380 exit (3);
381 }
382
383 if (arg == NULL)
384 {
385 gfc_status ("gfortran: Directory required after -M\n");
386 exit (3);
387 }
388
629ceb93 389 gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
6de9cd9a
DN
390 strcpy (gfc_option.module_dir, arg);
391 strcat (gfc_option.module_dir, "/");
7376d710
FXC
392
393 gfc_add_include_path (gfc_option.module_dir, true);
6de9cd9a
DN
394}
395
edf1eac2 396
944b8b35
FXC
397static void
398gfc_handle_fpe_trap_option (const char *arg)
399{
400 int result, pos = 0, n;
401 static const char * const exception[] = { "invalid", "denormal", "zero",
edf1eac2 402 "overflow", "underflow",
944b8b35
FXC
403 "precision", NULL };
404 static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
405 GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
406 GFC_FPE_UNDERFLOW, GFC_FPE_PRECISION,
407 0 };
408
409 while (*arg)
410 {
411 while (*arg == ',')
412 arg++;
edf1eac2 413
944b8b35
FXC
414 while (arg[pos] && arg[pos] != ',')
415 pos++;
edf1eac2 416
944b8b35
FXC
417 result = 0;
418 for (n = 0; exception[n] != NULL; n++)
419 {
420 if (exception[n] && strncmp (exception[n], arg, pos) == 0)
421 {
422 gfc_option.fpe |= opt_exception[n];
423 arg += pos;
424 pos = 0;
425 result = 1;
426 break;
427 }
428 }
edf1eac2 429 if (!result)
944b8b35
FXC
430 gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
431 }
432}
433
edf1eac2 434
6de9cd9a
DN
435/* Handle command-line options. Returns 0 if unrecognized, 1 if
436 recognized and handled. */
edf1eac2 437
6de9cd9a
DN
438int
439gfc_handle_option (size_t scode, const char *arg, int value)
440{
441 int result = 1;
442 enum opt_code code = (enum opt_code) scode;
443
444 /* Ignore file names. */
445 if (code == N_OPTS)
446 return 1;
447
448 switch (code)
449 {
450 default:
451 result = 0;
452 break;
453
454 case OPT_Wall:
4428e682 455 set_Wall (value);
6de9cd9a
DN
456 break;
457
458 case OPT_Waliasing:
459 gfc_option.warn_aliasing = value;
460 break;
461
3fbab549
JD
462 case OPT_Wampersand:
463 gfc_option.warn_ampersand = value;
464 break;
465
0b30ba3b
JD
466 case OPT_Wcharacter_truncation:
467 gfc_option.warn_character_truncation = value;
468 break;
469
6de9cd9a
DN
470 case OPT_Wconversion:
471 gfc_option.warn_conversion = value;
472 break;
473
474 case OPT_Wimplicit_interface:
475 gfc_option.warn_implicit_interface = value;
476 break;
477
478 case OPT_Wline_truncation:
479 gfc_option.warn_line_truncation = value;
480 break;
481
482 case OPT_Wsurprising:
483 gfc_option.warn_surprising = value;
484 break;
485
840bd9f7
SK
486 case OPT_Wtabs:
487 gfc_option.warn_tabs = value;
488 break;
489
490 case OPT_Wunderflow:
491 gfc_option.warn_underflow = value;
492 break;
493
a23eec13
SK
494 case OPT_fall_intrinsics:
495 gfc_option.flag_all_intrinsics = 1;
496 break;
497
498 case OPT_fautomatic:
499 gfc_option.flag_automatic = value;
500 break;
501
e6472bce
FXC
502 case OPT_fallow_leading_underscore:
503 gfc_option.flag_allow_leading_underscore = value;
504 break;
505
a23eec13
SK
506 case OPT_fbackslash:
507 gfc_option.flag_backslash = value;
508 break;
83d890b9 509
868d75db
FXC
510 case OPT_fbacktrace:
511 gfc_option.flag_backtrace = value;
512 break;
513
eedeea04
FXC
514 case OPT_fdump_core:
515 gfc_option.flag_dump_core = value;
516 break;
517
83d890b9
AL
518 case OPT_fcray_pointer:
519 gfc_option.flag_cray_pointer = value;
520 break;
6de9cd9a 521
973ff4c0
TS
522 case OPT_ff2c:
523 gfc_option.flag_f2c = value;
524 break;
525
6de9cd9a
DN
526 case OPT_fdollar_ok:
527 gfc_option.flag_dollar_ok = value;
528 break;
529
5a0aad31
FXC
530 case OPT_fexternal_blas:
531 gfc_option.flag_external_blas = value;
532 break;
533
534 case OPT_fblas_matmul_limit_:
535 gfc_option.blas_matmul_limit = value;
536 break;
537
e0bcf78c
TS
538 case OPT_fd_lines_as_code:
539 gfc_option.flag_d_lines = 1;
540 break;
541
542 case OPT_fd_lines_as_comments:
543 gfc_option.flag_d_lines = 0;
544 break;
545
6de9cd9a
DN
546 case OPT_fdump_parse_tree:
547 gfc_option.verbose = value;
548 break;
549
550 case OPT_ffixed_form:
551 gfc_option.source_form = FORM_FIXED;
552 break;
553
16ab8e74
BF
554 case OPT_ffixed_line_length_none:
555 gfc_option.fixed_line_length = 0;
556 break;
557
558 case OPT_ffixed_line_length_:
559 if (value != 0 && value < 7)
560 gfc_fatal_error ("Fixed line length must be at least seven.");
561 gfc_option.fixed_line_length = value;
562 break;
563
6de9cd9a
DN
564 case OPT_ffree_form:
565 gfc_option.source_form = FORM_FREE;
566 break;
567
6c7a4dfd
JJ
568 case OPT_fopenmp:
569 gfc_option.flag_openmp = value;
570 break;
571
16ab8e74
BF
572 case OPT_ffree_line_length_none:
573 gfc_option.free_line_length = 0;
574 break;
575
576 case OPT_ffree_line_length_:
27fabb5a
TS
577 if (value != 0 && value < 4)
578 gfc_fatal_error ("Free line length must be at least three.");
16ab8e74
BF
579 gfc_option.free_line_length = value;
580 break;
581
6de9cd9a
DN
582 case OPT_funderscoring:
583 gfc_option.flag_underscoring = value;
584 break;
585
586 case OPT_fsecond_underscore:
587 gfc_option.flag_second_underscore = value;
588 break;
589
86db887a
FXC
590 case OPT_static_libgfortran:
591#ifndef HAVE_LD_STATIC_DYNAMIC
592 gfc_fatal_error ("-static-libgfortran is not supported in this "
593 "configuration");
594#endif
595 break;
596
6de9cd9a
DN
597 case OPT_fimplicit_none:
598 gfc_option.flag_implicit_none = value;
599 break;
600
31198773
FXC
601 case OPT_fintrinsic_modules_path:
602 gfc_add_include_path (arg, false);
603 gfc_add_intrinsic_modules_path (arg);
604 break;
605
3f139fcf
BM
606 case OPT_fmax_errors_:
607 gfc_option.max_errors = value;
608 break;
609
6de9cd9a
DN
610 case OPT_fmax_stack_var_size_:
611 gfc_option.flag_max_stack_var_size = value;
612 break;
613
654b6073
FXC
614 case OPT_fmodule_private:
615 gfc_option.flag_module_private = value;
616 break;
617
54554825
JD
618 case OPT_frange_check:
619 gfc_option.flag_range_check = value;
620 break;
621
6de9cd9a
DN
622 case OPT_fpack_derived:
623 gfc_option.flag_pack_derived = value;
624 break;
625
626 case OPT_frepack_arrays:
627 gfc_option.flag_repack_arrays = value;
628 break;
629
2d7c7df6
JJ
630 case OPT_fpreprocessed:
631 gfc_option.flag_preprocessed = value;
632 break;
633
6de9cd9a
DN
634 case OPT_fmax_identifier_length_:
635 if (value > GFC_MAX_SYMBOL_LEN)
eb6d74fa 636 gfc_fatal_error ("Maximum supported identifier length is %d",
6de9cd9a
DN
637 GFC_MAX_SYMBOL_LEN);
638 gfc_option.max_identifier_length = value;
639 break;
640
3ae9eb27
SK
641 case OPT_fdefault_integer_8:
642 gfc_option.flag_default_integer = value;
6de9cd9a
DN
643 break;
644
3ae9eb27
SK
645 case OPT_fdefault_real_8:
646 gfc_option.flag_default_real = value;
6de9cd9a
DN
647 break;
648
3ae9eb27
SK
649 case OPT_fdefault_double_8:
650 gfc_option.flag_default_double = value;
6de9cd9a
DN
651 break;
652
653 case OPT_I:
31198773 654 gfc_add_include_path (arg, true);
6de9cd9a
DN
655 break;
656
657 case OPT_J:
658 case OPT_M:
659 gfc_handle_module_path_options (arg);
2d0b4bcd 660 break;
6de9cd9a 661
68d2e027
JD
662 case OPT_fsign_zero:
663 gfc_option.flag_sign_zero = value;
664 break;
665
944b8b35
FXC
666 case OPT_ffpe_trap_:
667 gfc_handle_fpe_trap_option (arg);
668 break;
669
6de9cd9a 670 case OPT_std_f95:
b7892582 671 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
6de9cd9a
DN
672 gfc_option.warn_std = GFC_STD_F95_OBS;
673 gfc_option.max_identifier_length = 31;
3fbab549 674 gfc_option.warn_ampersand = 1;
840bd9f7 675 gfc_option.warn_tabs = 0;
6de9cd9a
DN
676 break;
677
678 case OPT_std_f2003:
b7892582
JB
679 gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
680 | GFC_STD_F2003 | GFC_STD_F95;
681 gfc_option.warn_std = GFC_STD_F95_OBS;
5a06474c
JD
682 gfc_option.max_continue_fixed = 255;
683 gfc_option.max_continue_free = 255;
6de9cd9a 684 gfc_option.max_identifier_length = 63;
3fbab549 685 gfc_option.warn_ampersand = 1;
8135cfa8 686 gfc_option.warn_tabs = 0;
6de9cd9a
DN
687 break;
688
689 case OPT_std_gnu:
a47eec17 690 set_default_std_flags ();
c0309c74
RS
691 break;
692
693 case OPT_std_legacy:
a47eec17 694 set_default_std_flags ();
c0309c74 695 gfc_option.warn_std = 0;
b7892582
JB
696 break;
697
698 case OPT_Wnonstd_intrinsics:
73a5988f 699 gfc_option.warn_nonstd_intrinsics = value;
6de9cd9a 700 break;
25d8f0a2
TS
701
702 case OPT_fshort_enums:
703 gfc_option.fshort_enums = 1;
704 break;
eaa90d25
TK
705
706 case OPT_fconvert_little_endian:
d74b97cc 707 gfc_option.convert = GFC_CONVERT_LITTLE;
eaa90d25
TK
708 break;
709
710 case OPT_fconvert_big_endian:
d74b97cc 711 gfc_option.convert = GFC_CONVERT_BIG;
eaa90d25
TK
712 break;
713
714 case OPT_fconvert_native:
d74b97cc 715 gfc_option.convert = GFC_CONVERT_NATIVE;
eaa90d25
TK
716 break;
717
718 case OPT_fconvert_swap:
d74b97cc 719 gfc_option.convert = GFC_CONVERT_SWAP;
eaa90d25 720 break;
d67ab5ee
TK
721
722 case OPT_frecord_marker_4:
723 gfc_option.record_marker = 4;
724 break;
725
726 case OPT_frecord_marker_8:
727 gfc_option.record_marker = 8;
728 break;
07b3bbf2
TK
729
730 case OPT_fmax_subrecord_length_:
731 if (value > MAX_SUBRECORD_LENGTH)
edf1eac2
SK
732 gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
733 MAX_SUBRECORD_LENGTH);
07b3bbf2
TK
734
735 gfc_option.max_subrecord_length = value;
1e7de83b
AL
736 break;
737
738 case OPT_frecursive:
739 gfc_option.flag_recursive = 1;
740 break;
6de9cd9a
DN
741 }
742
743 return result;
744}
This page took 1.082008 seconds and 5 git commands to generate.