OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [fortran/] [options.c] - Blame information for rev 285

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 285 jeremybenn
/* Parse and display command line options.
2
   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3
   2009, 2010
4
   Free Software Foundation, Inc.
5
   Contributed by Andy Vaught
6
 
7
This file is part of GCC.
8
 
9
GCC is free software; you can redistribute it and/or modify it under
10
the terms of the GNU General Public License as published by the Free
11
Software Foundation; either version 3, or (at your option) any later
12
version.
13
 
14
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15
WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17
for more details.
18
 
19
You should have received a copy of the GNU General Public License
20
along with GCC; see the file COPYING3.  If not see
21
<http://www.gnu.org/licenses/>.  */
22
 
23
#include "config.h"
24
#include "system.h"
25
#include "coretypes.h"
26
#include "tree.h"
27
#include "flags.h"
28
#include "intl.h"
29
#include "opts.h"
30
#include "options.h"
31
#include "params.h"
32
#include "tree-inline.h"
33
#include "gfortran.h"
34
#include "target.h"
35
#include "cpp.h"
36
#include "toplev.h"
37
#include "tm.h"
38
 
39
gfc_option_t gfc_option;
40
 
41
 
42
/* Set flags that control warnings and errors for different
43
   Fortran standards to their default values.  Keep in sync with
44
   libgfortran/runtime/compile_options.c (init_compile_options).  */
45
 
46
static void
47
set_default_std_flags (void)
48
{
49
  gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
50
    | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
51
    | GFC_STD_GNU | GFC_STD_LEGACY;
52
  gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
53
}
54
 
55
 
56
/* Get ready for options handling. Keep in sync with
57
   libgfortran/runtime/compile_options.c (init_compile_options). */
58
 
59
unsigned int
60
gfc_init_options (unsigned int argc, const char **argv)
61
{
62
  gfc_source_file = NULL;
63
  gfc_option.module_dir = NULL;
64
  gfc_option.source_form = FORM_UNKNOWN;
65
  gfc_option.fixed_line_length = 72;
66
  gfc_option.free_line_length = 132;
67
  gfc_option.max_continue_fixed = 255;
68
  gfc_option.max_continue_free = 255;
69
  gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
70
  gfc_option.max_subrecord_length = 0;
71
  gfc_option.flag_max_array_constructor = 65535;
72
  gfc_option.convert = GFC_CONVERT_NATIVE;
73
  gfc_option.record_marker = 0;
74
  gfc_option.dump_parse_tree = 0;
75
 
76
  gfc_option.warn_aliasing = 0;
77
  gfc_option.warn_ampersand = 0;
78
  gfc_option.warn_character_truncation = 0;
79
  gfc_option.warn_array_temp = 0;
80
  gfc_option.warn_conversion = 0;
81
  gfc_option.warn_implicit_interface = 0;
82
  gfc_option.warn_line_truncation = 0;
83
  gfc_option.warn_surprising = 0;
84
  gfc_option.warn_tabs = 1;
85
  gfc_option.warn_underflow = 1;
86
  gfc_option.warn_intrinsic_shadow = 0;
87
  gfc_option.warn_intrinsics_std = 0;
88
  gfc_option.warn_align_commons = 1;
89
  gfc_option.max_errors = 25;
90
 
91
  gfc_option.flag_all_intrinsics = 0;
92
  gfc_option.flag_default_double = 0;
93
  gfc_option.flag_default_integer = 0;
94
  gfc_option.flag_default_real = 0;
95
  gfc_option.flag_dollar_ok = 0;
96
  gfc_option.flag_underscoring = 1;
97
  gfc_option.flag_whole_file = 0;
98
  gfc_option.flag_f2c = 0;
99
  gfc_option.flag_second_underscore = -1;
100
  gfc_option.flag_implicit_none = 0;
101
 
102
  /* Default value of flag_max_stack_var_size is set in gfc_post_options.  */
103
  gfc_option.flag_max_stack_var_size = -2;
104
 
105
  gfc_option.flag_range_check = 1;
106
  gfc_option.flag_pack_derived = 0;
107
  gfc_option.flag_repack_arrays = 0;
108
  gfc_option.flag_preprocessed = 0;
109
  gfc_option.flag_automatic = 1;
110
  gfc_option.flag_backslash = 0;
111
  gfc_option.flag_module_private = 0;
112
  gfc_option.flag_backtrace = 0;
113
  gfc_option.flag_allow_leading_underscore = 0;
114
  gfc_option.flag_dump_core = 0;
115
  gfc_option.flag_external_blas = 0;
116
  gfc_option.blas_matmul_limit = 30;
117
  gfc_option.flag_cray_pointer = 0;
118
  gfc_option.flag_d_lines = -1;
119
  gfc_option.flag_openmp = 0;
120
  gfc_option.flag_sign_zero = 1;
121
  gfc_option.flag_recursive = 0;
122
  gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
123
  gfc_option.flag_init_integer_value = 0;
124
  gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
125
  gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
126
  gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
127
  gfc_option.flag_init_character_value = (char)0;
128
  gfc_option.flag_align_commons = 1;
129
  gfc_option.flag_protect_parens = 1;
130
 
131
  gfc_option.fpe = 0;
132
  gfc_option.rtcheck = 0;
133
 
134
  /* Argument pointers cannot point to anything but their argument.  */
135
  flag_argument_noalias = 3;
136
 
137
  flag_errno_math = 0;
138
 
139
  set_default_std_flags ();
140
 
141
  /* -fshort-enums can be default on some targets.  */
142
  flag_short_enums = targetm.default_short_enums ();
143
 
144
  /* Initialize cpp-related options.  */
145
  gfc_cpp_init_options(argc, argv);
146
 
147
  return CL_Fortran;
148
}
149
 
150
 
151
/* Determine the source form from the filename extension.  We assume
152
   case insensitivity.  */
153
 
154
static gfc_source_form
155
form_from_filename (const char *filename)
156
{
157
  static const struct
158
  {
159
    const char *extension;
160
    gfc_source_form form;
161
  }
162
  exttype[] =
163
  {
164
    {
165
    ".f90", FORM_FREE}
166
    ,
167
    {
168
    ".f95", FORM_FREE}
169
    ,
170
    {
171
    ".f03", FORM_FREE}
172
    ,
173
    {
174
    ".f08", FORM_FREE}
175
    ,
176
    {
177
    ".f", FORM_FIXED}
178
    ,
179
    {
180
    ".for", FORM_FIXED}
181
    ,
182
    {
183
    ".ftn", FORM_FIXED}
184
    ,
185
    {
186
    "", FORM_UNKNOWN}
187
  };            /* sentinel value */
188
 
189
  gfc_source_form f_form;
190
  const char *fileext;
191
  int i;
192
 
193
  /* Find end of file name.  Note, filename is either a NULL pointer or
194
     a NUL terminated string.  */
195
  i = 0;
196
  while (filename[i] != '\0')
197
    i++;
198
 
199
  /* Find last period.  */
200
  while (i >= 0 && (filename[i] != '.'))
201
    i--;
202
 
203
  /* Did we see a file extension?  */
204
  if (i < 0)
205
    return FORM_UNKNOWN; /* Nope  */
206
 
207
  /* Get file extension and compare it to others.  */
208
  fileext = &(filename[i]);
209
 
210
  i = -1;
211
  f_form = FORM_UNKNOWN;
212
  do
213
    {
214
      i++;
215
      if (strcasecmp (fileext, exttype[i].extension) == 0)
216
        {
217
          f_form = exttype[i].form;
218
          break;
219
        }
220
    }
221
  while (exttype[i].form != FORM_UNKNOWN);
222
 
223
  return f_form;
224
}
225
 
226
 
227
/* Finalize commandline options.  */
228
 
229
bool
230
gfc_post_options (const char **pfilename)
231
{
232
  const char *filename = *pfilename, *canon_source_file = NULL;
233
  char *source_path;
234
  int i;
235
 
236
  /* Excess precision other than "fast" requires front-end
237
     support.  */
238
  if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD
239
      && TARGET_FLT_EVAL_METHOD_NON_DEFAULT)
240
    sorry ("-fexcess-precision=standard for Fortran");
241
  flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
242
 
243
  /* Whole program needs whole file mode.  */
244
  if (flag_whole_program)
245
    gfc_option.flag_whole_file = 1;
246
 
247
  /* Enable whole-file mode if LTO is in effect.  */
248
  if (flag_lto || flag_whopr)
249
    gfc_option.flag_whole_file = 1;
250
 
251
  /* -fbounds-check is equivalent to -fcheck=bounds */
252
  if (flag_bounds_check)
253
    gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS;
254
 
255
  if (flag_compare_debug)
256
    gfc_option.dump_parse_tree = 0;
257
 
258
  /* Verify the input file name.  */
259
  if (!filename || strcmp (filename, "-") == 0)
260
    {
261
      filename = "";
262
    }
263
 
264
  if (gfc_option.flag_preprocessed)
265
    {
266
      /* For preprocessed files, if the first tokens are of the form # NUM.
267
         handle the directives so we know the original file name.  */
268
      gfc_source_file = gfc_read_orig_filename (filename, &canon_source_file);
269
      if (gfc_source_file == NULL)
270
        gfc_source_file = filename;
271
      else
272
        *pfilename = gfc_source_file;
273
    }
274
  else
275
    gfc_source_file = filename;
276
 
277
  if (canon_source_file == NULL)
278
    canon_source_file = gfc_source_file;
279
 
280
  /* Adds the path where the source file is to the list of include files.  */
281
 
282
  i = strlen (canon_source_file);
283
  while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
284
    i--;
285
 
286
  if (i != 0)
287
    {
288
      source_path = (char *) alloca (i + 1);
289
      memcpy (source_path, canon_source_file, i);
290
      source_path[i] = 0;
291
      gfc_add_include_path (source_path, true, true);
292
    }
293
  else
294
    gfc_add_include_path (".", true, true);
295
 
296
  if (canon_source_file != gfc_source_file)
297
    gfc_free (CONST_CAST (char *, canon_source_file));
298
 
299
  /* Decide which form the file will be read in as.  */
300
 
301
  if (gfc_option.source_form != FORM_UNKNOWN)
302
    gfc_current_form = gfc_option.source_form;
303
  else
304
    {
305
      gfc_current_form = form_from_filename (filename);
306
 
307
      if (gfc_current_form == FORM_UNKNOWN)
308
        {
309
          gfc_current_form = FORM_FREE;
310
          gfc_warning_now ("Reading file '%s' as free form",
311
                           (filename[0] == '\0') ? "<stdin>" : filename);
312
        }
313
    }
314
 
315
  /* If the user specified -fd-lines-as-{code|comments} verify that we're
316
     in fixed form.  */
317
  if (gfc_current_form == FORM_FREE)
318
    {
319
      if (gfc_option.flag_d_lines == 0)
320
        gfc_warning_now ("'-fd-lines-as-comments' has no effect "
321
                         "in free form");
322
      else if (gfc_option.flag_d_lines == 1)
323
        gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
324
    }
325
 
326
  /* If -pedantic, warn about the use of GNU extensions.  */
327
  if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
328
    gfc_option.warn_std |= GFC_STD_GNU;
329
  /* -std=legacy -pedantic is effectively -std=gnu.  */
330
  if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
331
    gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
332
 
333
  /* If the user didn't explicitly specify -f(no)-second-underscore we
334
     use it if we're trying to be compatible with f2c, and not
335
     otherwise.  */
336
  if (gfc_option.flag_second_underscore == -1)
337
    gfc_option.flag_second_underscore = gfc_option.flag_f2c;
338
 
339
  if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
340
      && gfc_option.flag_max_stack_var_size != 0)
341
    gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
342
                     gfc_option.flag_max_stack_var_size);
343
  else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
344
    gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
345
  else if (!gfc_option.flag_automatic && gfc_option.flag_openmp)
346
    gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
347
                     "-fopenmp");
348
  else if (gfc_option.flag_max_stack_var_size != -2
349
           && gfc_option.flag_recursive)
350
    gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
351
                     gfc_option.flag_max_stack_var_size);
352
  else if (gfc_option.flag_max_stack_var_size != -2
353
           && gfc_option.flag_openmp)
354
    gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
355
                     "implied by -fopenmp",
356
                     gfc_option.flag_max_stack_var_size);
357
 
358
  /* Implement -frecursive as -fmax-stack-var-size=-1.  */
359
  if (gfc_option.flag_recursive)
360
    gfc_option.flag_max_stack_var_size = -1;
361
 
362
  /* Implied -frecursive; implemented as -fmax-stack-var-size=-1.  */
363
  if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp
364
      && gfc_option.flag_automatic)
365
    {
366
      gfc_option.flag_recursive = 1;
367
      gfc_option.flag_max_stack_var_size = -1;
368
    }
369
 
370
  /* Set default.  */
371
  if (gfc_option.flag_max_stack_var_size == -2)
372
    gfc_option.flag_max_stack_var_size = 32768;
373
 
374
  /* Implement -fno-automatic as -fmax-stack-var-size=0.  */
375
  if (!gfc_option.flag_automatic)
376
    gfc_option.flag_max_stack_var_size = 0;
377
 
378
  if (pedantic)
379
    {
380
      gfc_option.warn_ampersand = 1;
381
      gfc_option.warn_tabs = 0;
382
    }
383
 
384
  if (pedantic && gfc_option.flag_whole_file)
385
    gfc_option.flag_whole_file = 2;
386
 
387
  gfc_cpp_post_options ();
388
 
389
/* FIXME: return gfc_cpp_preprocess_only ();
390
 
391
   The return value of this function indicates whether the
392
   backend needs to be initialized. On -E, we don't need
393
   the backend. However, if we return 'true' here, an
394
   ICE occurs. Initializing the backend doesn't hurt much,
395
   hence, for now we can live with it as is.  */
396
  return false;
397
}
398
 
399
 
400
/* Set the options for -Wall.  */
401
 
402
static void
403
set_Wall (int setting)
404
{
405
  gfc_option.warn_aliasing = setting;
406
  gfc_option.warn_ampersand = setting;
407
  gfc_option.warn_line_truncation = setting;
408
  gfc_option.warn_surprising = setting;
409
  gfc_option.warn_tabs = !setting;
410
  gfc_option.warn_underflow = setting;
411
  gfc_option.warn_intrinsic_shadow = setting;
412
  gfc_option.warn_intrinsics_std = setting;
413
  gfc_option.warn_character_truncation = setting;
414
 
415
  warn_unused = setting;
416
  warn_return_type = setting;
417
  warn_switch = setting;
418
 
419
  /* We save the value of warn_uninitialized, since if they put
420
     -Wuninitialized on the command line, we need to generate a
421
     warning about not using it without also specifying -O.  */
422
  if (setting == 0)
423
    warn_uninitialized = 0;
424
  else if (warn_uninitialized != 1)
425
    warn_uninitialized = 2;
426
}
427
 
428
 
429
static void
430
gfc_handle_module_path_options (const char *arg)
431
{
432
 
433
  if (gfc_option.module_dir != NULL)
434
    gfc_fatal_error ("gfortran: Only one -J option allowed");
435
 
436
  gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
437
  strcpy (gfc_option.module_dir, arg);
438
  strcat (gfc_option.module_dir, "/");
439
 
440
  gfc_add_include_path (gfc_option.module_dir, true, false);
441
}
442
 
443
 
444
static void
445
gfc_handle_fpe_trap_option (const char *arg)
446
{
447
  int result, pos = 0, n;
448
  static const char * const exception[] = { "invalid", "denormal", "zero",
449
                                            "overflow", "underflow",
450
                                            "precision", NULL };
451
  static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
452
                                       GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
453
                                       GFC_FPE_UNDERFLOW, GFC_FPE_PRECISION,
454
 
455
 
456
  while (*arg)
457
    {
458
      while (*arg == ',')
459
        arg++;
460
 
461
      while (arg[pos] && arg[pos] != ',')
462
        pos++;
463
 
464
      result = 0;
465
      for (n = 0; exception[n] != NULL; n++)
466
        {
467
          if (exception[n] && strncmp (exception[n], arg, pos) == 0)
468
            {
469
              gfc_option.fpe |= opt_exception[n];
470
              arg += pos;
471
              pos = 0;
472
              result = 1;
473
              break;
474
            }
475
        }
476
      if (!result)
477
        gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
478
    }
479
}
480
 
481
 
482
static void
483
gfc_handle_runtime_check_option (const char *arg)
484
{
485
  int result, pos = 0, n;
486
  static const char * const optname[] = { "all", "bounds", "array-temps",
487
                                          "recursion", "do", "pointer",
488
                                          "mem", NULL };
489
  static const int optmask[] = { GFC_RTCHECK_ALL, GFC_RTCHECK_BOUNDS,
490
                                 GFC_RTCHECK_ARRAY_TEMPS,
491
                                 GFC_RTCHECK_RECURSION, GFC_RTCHECK_DO,
492
                                 GFC_RTCHECK_POINTER, GFC_RTCHECK_MEM,
493
 
494
 
495
  while (*arg)
496
    {
497
      while (*arg == ',')
498
        arg++;
499
 
500
      while (arg[pos] && arg[pos] != ',')
501
        pos++;
502
 
503
      result = 0;
504
      for (n = 0; optname[n] != NULL; n++)
505
        {
506
          if (optname[n] && strncmp (optname[n], arg, pos) == 0)
507
            {
508
              gfc_option.rtcheck |= optmask[n];
509
              arg += pos;
510
              pos = 0;
511
              result = 1;
512
              break;
513
            }
514
        }
515
      if (!result)
516
        gfc_fatal_error ("Argument to -fcheck is not valid: %s", arg);
517
    }
518
}
519
 
520
 
521
/* Handle command-line options.  Returns 0 if unrecognized, 1 if
522
   recognized and handled.  */
523
 
524
int
525
gfc_handle_option (size_t scode, const char *arg, int value)
526
{
527
  int result = 1;
528
  enum opt_code code = (enum opt_code) scode;
529
 
530
  /* Ignore file names.  */
531
  if (code == N_OPTS)
532
    return 1;
533
 
534
  if (gfc_cpp_handle_option (scode, arg, value) == 1)
535
    return 1;
536
 
537
  switch (code)
538
    {
539
    default:
540
      result = 0;
541
      break;
542
 
543
    case OPT_Wall:
544
      set_Wall (value);
545
      break;
546
 
547
    case OPT_Waliasing:
548
      gfc_option.warn_aliasing = value;
549
      break;
550
 
551
    case OPT_Wampersand:
552
      gfc_option.warn_ampersand = value;
553
      break;
554
 
555
    case OPT_Warray_temporaries:
556
      gfc_option.warn_array_temp = value;
557
      break;
558
 
559
    case OPT_Wcharacter_truncation:
560
      gfc_option.warn_character_truncation = value;
561
      break;
562
 
563
    case OPT_Wconversion:
564
      gfc_option.warn_conversion = value;
565
      break;
566
 
567
    case OPT_Wimplicit_interface:
568
      gfc_option.warn_implicit_interface = value;
569
      break;
570
 
571
    case OPT_Wimplicit_procedure:
572
      gfc_option.warn_implicit_procedure = value;
573
      break;
574
 
575
    case OPT_Wline_truncation:
576
      gfc_option.warn_line_truncation = value;
577
      break;
578
 
579
    case OPT_Wreturn_type:
580
      warn_return_type = value;
581
      break;
582
 
583
    case OPT_Wsurprising:
584
      gfc_option.warn_surprising = value;
585
      break;
586
 
587
    case OPT_Wtabs:
588
      gfc_option.warn_tabs = value;
589
      break;
590
 
591
    case OPT_Wunderflow:
592
      gfc_option.warn_underflow = value;
593
      break;
594
 
595
    case OPT_Wintrinsic_shadow:
596
      gfc_option.warn_intrinsic_shadow = value;
597
      break;
598
 
599
    case OPT_Walign_commons:
600
      gfc_option.warn_align_commons = value;
601
      break;
602
 
603
    case OPT_fall_intrinsics:
604
      gfc_option.flag_all_intrinsics = 1;
605
      break;
606
 
607
    case OPT_fautomatic:
608
      gfc_option.flag_automatic = value;
609
      break;
610
 
611
    case OPT_fallow_leading_underscore:
612
      gfc_option.flag_allow_leading_underscore = value;
613
      break;
614
 
615
    case OPT_fbackslash:
616
      gfc_option.flag_backslash = value;
617
      break;
618
 
619
    case OPT_fbacktrace:
620
      gfc_option.flag_backtrace = value;
621
      break;
622
 
623
    case OPT_fcheck_array_temporaries:
624
      gfc_option.rtcheck |= GFC_RTCHECK_ARRAY_TEMPS;
625
      break;
626
 
627
    case OPT_fdump_core:
628
      gfc_option.flag_dump_core = value;
629
      break;
630
 
631
    case OPT_fcray_pointer:
632
      gfc_option.flag_cray_pointer = value;
633
      break;
634
 
635
    case OPT_ff2c:
636
      gfc_option.flag_f2c = value;
637
      break;
638
 
639
    case OPT_fdollar_ok:
640
      gfc_option.flag_dollar_ok = value;
641
      break;
642
 
643
    case OPT_fexternal_blas:
644
      gfc_option.flag_external_blas = value;
645
      break;
646
 
647
    case OPT_fblas_matmul_limit_:
648
      gfc_option.blas_matmul_limit = value;
649
      break;
650
 
651
    case OPT_fd_lines_as_code:
652
      gfc_option.flag_d_lines = 1;
653
      break;
654
 
655
    case OPT_fd_lines_as_comments:
656
      gfc_option.flag_d_lines = 0;
657
      break;
658
 
659
    case OPT_fdump_parse_tree:
660
      gfc_option.dump_parse_tree = value;
661
      break;
662
 
663
    case OPT_ffixed_form:
664
      gfc_option.source_form = FORM_FIXED;
665
      break;
666
 
667
    case OPT_ffixed_line_length_none:
668
      gfc_option.fixed_line_length = 0;
669
      break;
670
 
671
    case OPT_ffixed_line_length_:
672
      if (value != 0 && value < 7)
673
        gfc_fatal_error ("Fixed line length must be at least seven.");
674
      gfc_option.fixed_line_length = value;
675
      break;
676
 
677
    case OPT_ffree_form:
678
      gfc_option.source_form = FORM_FREE;
679
      break;
680
 
681
    case OPT_fopenmp:
682
      gfc_option.flag_openmp = value;
683
      break;
684
 
685
    case OPT_ffree_line_length_none:
686
      gfc_option.free_line_length = 0;
687
      break;
688
 
689
    case OPT_ffree_line_length_:
690
      if (value != 0 && value < 4)
691
        gfc_fatal_error ("Free line length must be at least three.");
692
      gfc_option.free_line_length = value;
693
      break;
694
 
695
    case OPT_funderscoring:
696
      gfc_option.flag_underscoring = value;
697
      break;
698
 
699
    case OPT_fwhole_file:
700
      gfc_option.flag_whole_file = 1;
701
      break;
702
 
703
    case OPT_fsecond_underscore:
704
      gfc_option.flag_second_underscore = value;
705
      break;
706
 
707
    case OPT_static_libgfortran:
708
#ifndef HAVE_LD_STATIC_DYNAMIC
709
      gfc_fatal_error ("-static-libgfortran is not supported in this "
710
                       "configuration");
711
#endif
712
      break;
713
 
714
    case OPT_fimplicit_none:
715
      gfc_option.flag_implicit_none = value;
716
      break;
717
 
718
    case OPT_fintrinsic_modules_path:
719
      gfc_add_include_path (arg, false, false);
720
      gfc_add_intrinsic_modules_path (arg);
721
      break;
722
 
723
    case OPT_fmax_array_constructor_:
724
      gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535;
725
      break;
726
 
727
    case OPT_fmax_errors_:
728
      gfc_option.max_errors = value;
729
      break;
730
 
731
    case OPT_fmax_stack_var_size_:
732
      gfc_option.flag_max_stack_var_size = value;
733
      break;
734
 
735
    case OPT_fmodule_private:
736
      gfc_option.flag_module_private = value;
737
      break;
738
 
739
    case OPT_frange_check:
740
      gfc_option.flag_range_check = value;
741
      break;
742
 
743
    case OPT_fpack_derived:
744
      gfc_option.flag_pack_derived = value;
745
      break;
746
 
747
    case OPT_frepack_arrays:
748
      gfc_option.flag_repack_arrays = value;
749
      break;
750
 
751
    case OPT_fpreprocessed:
752
      gfc_option.flag_preprocessed = value;
753
      break;
754
 
755
    case OPT_fmax_identifier_length_:
756
      if (value > GFC_MAX_SYMBOL_LEN)
757
        gfc_fatal_error ("Maximum supported identifier length is %d",
758
                         GFC_MAX_SYMBOL_LEN);
759
      gfc_option.max_identifier_length = value;
760
      break;
761
 
762
    case OPT_fdefault_integer_8:
763
      gfc_option.flag_default_integer = value;
764
      break;
765
 
766
    case OPT_fdefault_real_8:
767
      gfc_option.flag_default_real = value;
768
      break;
769
 
770
    case OPT_fdefault_double_8:
771
      gfc_option.flag_default_double = value;
772
      break;
773
 
774
    case OPT_finit_local_zero:
775
      gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
776
      gfc_option.flag_init_integer_value = 0;
777
      gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
778
      gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
779
      gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
780
      gfc_option.flag_init_character_value = (char)0;
781
      break;
782
 
783
    case OPT_finit_logical_:
784
      if (!strcasecmp (arg, "false"))
785
        gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
786
      else if (!strcasecmp (arg, "true"))
787
        gfc_option.flag_init_logical = GFC_INIT_LOGICAL_TRUE;
788
      else
789
        gfc_fatal_error ("Unrecognized option to -finit-logical: %s",
790
                         arg);
791
      break;
792
 
793
    case OPT_finit_real_:
794
      if (!strcasecmp (arg, "zero"))
795
        gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
796
      else if (!strcasecmp (arg, "nan"))
797
        gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
798
      else if (!strcasecmp (arg, "snan"))
799
        gfc_option.flag_init_real = GFC_INIT_REAL_SNAN;
800
      else if (!strcasecmp (arg, "inf"))
801
        gfc_option.flag_init_real = GFC_INIT_REAL_INF;
802
      else if (!strcasecmp (arg, "-inf"))
803
        gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
804
      else
805
        gfc_fatal_error ("Unrecognized option to -finit-real: %s",
806
                         arg);
807
      break;
808
 
809
    case OPT_finit_integer_:
810
      gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
811
      gfc_option.flag_init_integer_value = atoi (arg);
812
      break;
813
 
814
    case OPT_finit_character_:
815
      if (value >= 0 && value <= 127)
816
        {
817
          gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
818
          gfc_option.flag_init_character_value = (char)value;
819
        }
820
      else
821
        gfc_fatal_error ("The value of n in -finit-character=n must be "
822
                         "between 0 and 127");
823
      break;
824
 
825
    case OPT_I:
826
      gfc_add_include_path (arg, true, false);
827
      break;
828
 
829
    case OPT_J:
830
      gfc_handle_module_path_options (arg);
831
      break;
832
 
833
    case OPT_fsign_zero:
834
      gfc_option.flag_sign_zero = value;
835
      break;
836
 
837
    case OPT_ffpe_trap_:
838
      gfc_handle_fpe_trap_option (arg);
839
      break;
840
 
841
    case OPT_std_f95:
842
      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
843
      gfc_option.warn_std = GFC_STD_F95_OBS;
844
      gfc_option.max_continue_fixed = 19;
845
      gfc_option.max_continue_free = 39;
846
      gfc_option.max_identifier_length = 31;
847
      gfc_option.warn_ampersand = 1;
848
      gfc_option.warn_tabs = 0;
849
      break;
850
 
851
    case OPT_std_f2003:
852
      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
853
        | GFC_STD_F2003 | GFC_STD_F95;
854
      gfc_option.warn_std = GFC_STD_F95_OBS;
855
      gfc_option.max_identifier_length = 63;
856
      gfc_option.warn_ampersand = 1;
857
      gfc_option.warn_tabs = 0;
858
      break;
859
 
860
    case OPT_std_f2008:
861
      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77
862
        | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
863
      gfc_option.warn_std = GFC_STD_F95_OBS;
864
      gfc_option.max_identifier_length = 63;
865
      gfc_option.warn_ampersand = 1;
866
      gfc_option.warn_tabs = 0;
867
      break;
868
 
869
    case OPT_std_gnu:
870
      set_default_std_flags ();
871
      break;
872
 
873
    case OPT_std_legacy:
874
      set_default_std_flags ();
875
      gfc_option.warn_std = 0;
876
      break;
877
 
878
    case OPT_Wintrinsics_std:
879
      gfc_option.warn_intrinsics_std = value;
880
      break;
881
 
882
    case OPT_fshort_enums:
883
      flag_short_enums = 1;
884
      break;
885
 
886
    case OPT_fconvert_little_endian:
887
      gfc_option.convert = GFC_CONVERT_LITTLE;
888
      break;
889
 
890
    case OPT_fconvert_big_endian:
891
      gfc_option.convert = GFC_CONVERT_BIG;
892
      break;
893
 
894
    case OPT_fconvert_native:
895
      gfc_option.convert = GFC_CONVERT_NATIVE;
896
      break;
897
 
898
    case OPT_fconvert_swap:
899
      gfc_option.convert = GFC_CONVERT_SWAP;
900
      break;
901
 
902
    case OPT_frecord_marker_4:
903
      gfc_option.record_marker = 4;
904
      break;
905
 
906
    case OPT_frecord_marker_8:
907
      gfc_option.record_marker = 8;
908
      break;
909
 
910
    case OPT_fmax_subrecord_length_:
911
      if (value > MAX_SUBRECORD_LENGTH)
912
        gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
913
                         MAX_SUBRECORD_LENGTH);
914
 
915
      gfc_option.max_subrecord_length = value;
916
      break;
917
 
918
    case OPT_frecursive:
919
      gfc_option.flag_recursive = 1;
920
      break;
921
 
922
    case OPT_falign_commons:
923
      gfc_option.flag_align_commons = value;
924
      break;
925
 
926
    case OPT_fprotect_parens:
927
      gfc_option.flag_protect_parens = value;
928
      break;
929
 
930
    case OPT_fcheck_:
931
      gfc_handle_runtime_check_option (arg);
932
      break;
933
 
934
    }
935
 
936
  return result;
937
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.