| 1 |
14 |
jlechner |
/* Handling of compile-time options that influence the library.
|
| 2 |
|
|
Copyright (C) 2005 Free Software Foundation, Inc.
|
| 3 |
|
|
|
| 4 |
|
|
This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
| 5 |
|
|
|
| 6 |
|
|
Libgfortran is free software; you can redistribute it and/or modify
|
| 7 |
|
|
it under the terms of the GNU General Public License as published by
|
| 8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
| 9 |
|
|
any later version.
|
| 10 |
|
|
|
| 11 |
|
|
In addition to the permissions in the GNU General Public License, the
|
| 12 |
|
|
Free Software Foundation gives you unlimited permission to link the
|
| 13 |
|
|
compiled version of this file into combinations with other programs,
|
| 14 |
|
|
and to distribute those combinations without any restriction coming
|
| 15 |
|
|
from the use of this file. (The General Public License restrictions
|
| 16 |
|
|
do apply in other respects; for example, they cover modification of
|
| 17 |
|
|
the file, and distribution when not linked into a combine
|
| 18 |
|
|
executable.)
|
| 19 |
|
|
|
| 20 |
|
|
Libgfortran is distributed in the hope that it will be useful,
|
| 21 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 22 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 23 |
|
|
GNU General Public License for more details.
|
| 24 |
|
|
|
| 25 |
|
|
You should have received a copy of the GNU General Public License
|
| 26 |
|
|
along with libgfortran; see the file COPYING. If not, write to
|
| 27 |
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
| 28 |
|
|
Boston, MA 02110-1301, USA. */
|
| 29 |
|
|
|
| 30 |
|
|
#include "config.h"
|
| 31 |
|
|
|
| 32 |
|
|
#include "libgfortran.h"
|
| 33 |
|
|
|
| 34 |
|
|
|
| 35 |
|
|
/* Useful compile-time options will be stored in here. */
|
| 36 |
|
|
compile_options_t compile_options;
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
/* Prototypes */
|
| 40 |
|
|
extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
|
| 41 |
|
|
export_proto(set_std);
|
| 42 |
|
|
|
| 43 |
|
|
|
| 44 |
|
|
void
|
| 45 |
|
|
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
|
| 46 |
|
|
GFC_INTEGER_4 pedantic)
|
| 47 |
|
|
{
|
| 48 |
|
|
compile_options.pedantic = pedantic;
|
| 49 |
|
|
compile_options.warn_std = warn_std;
|
| 50 |
|
|
compile_options.allow_std = allow_std;
|
| 51 |
|
|
}
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
|
|
/* Default values for the compile-time options. Keep in sync with
|
| 55 |
|
|
gcc/fortran/options.c (gfc_init_options). */
|
| 56 |
|
|
void
|
| 57 |
|
|
init_compile_options (void)
|
| 58 |
|
|
{
|
| 59 |
|
|
compile_options.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
| 60 |
|
|
| GFC_STD_F2003 | GFC_STD_LEGACY;
|
| 61 |
|
|
compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
|
| 62 |
|
|
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY;
|
| 63 |
|
|
compile_options.pedantic = 0;
|
| 64 |
|
|
}
|
| 65 |
|
|
|
| 66 |
|
|
/* Function called by the front-end to tell us the
|
| 67 |
|
|
default for unformatted data conversion. */
|
| 68 |
|
|
|
| 69 |
|
|
extern void set_convert (int);
|
| 70 |
|
|
export_proto (set_convert);
|
| 71 |
|
|
|
| 72 |
|
|
void
|
| 73 |
|
|
set_convert (int conv)
|
| 74 |
|
|
{
|
| 75 |
|
|
compile_options.convert = conv;
|
| 76 |
|
|
}
|
| 77 |
|
|
|
| 78 |
|
|
extern void set_record_marker (int);
|
| 79 |
|
|
export_proto (set_record_marker);
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
|
|
void
|
| 83 |
|
|
set_record_marker (int val)
|
| 84 |
|
|
{
|
| 85 |
|
|
|
| 86 |
|
|
switch(val)
|
| 87 |
|
|
{
|
| 88 |
|
|
case 4:
|
| 89 |
|
|
if (sizeof (GFC_INTEGER_4) != sizeof (gfc_offset))
|
| 90 |
|
|
compile_options.record_marker = sizeof (GFC_INTEGER_4);
|
| 91 |
|
|
break;
|
| 92 |
|
|
|
| 93 |
|
|
case 8:
|
| 94 |
|
|
if (sizeof (GFC_INTEGER_8) != sizeof (gfc_offset))
|
| 95 |
|
|
compile_options.record_marker = sizeof (GFC_INTEGER_8);
|
| 96 |
|
|
break;
|
| 97 |
|
|
|
| 98 |
|
|
default:
|
| 99 |
|
|
runtime_error ("Invalid value for record marker");
|
| 100 |
|
|
break;
|
| 101 |
|
|
}
|
| 102 |
|
|
}
|