]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/runtime/main.c
Update copyright years.
[thirdparty/gcc.git] / libgfortran / runtime / main.c
CommitLineData
fbd26352 1/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
4ee9c684 2 Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
3
d151c82c 4This file is part of the GNU Fortran runtime library (libgfortran).
4ee9c684 5
b417ea8c 6Libgfortran is free software; you can redistribute it and/or modify
4ee9c684 7it under the terms of the GNU General Public License as published by
6bc9506f 8the Free Software Foundation; either version 3, or (at your option)
4ee9c684 9any later version.
10
b417ea8c 11Libgfortran is distributed in the hope that it will be useful,
4ee9c684 12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
6bc9506f 16Under Section 7 of GPL version 3, you are granted additional
17permissions described in the GCC Runtime Library Exception, version
183.1, as published by the Free Software Foundation.
19
20You should have received a copy of the GNU General Public License and
21a copy of the GCC Runtime Library Exception along with this program;
22see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23<http://www.gnu.org/licenses/>. */
4ee9c684 24
41f2d5e8 25#include "libgfortran.h"
4ee9c684 26
4ee9c684 27
76875ccb 28/* Stupid function to be sure the constructor is always linked in, even
29 in the case of static linking. See PR libfortran/22298 for details. */
30void
31stupid_function_name_for_static_linking (void)
32{
33 return;
34}
35
4ee9c684 36
37static int argc_save;
38static char **argv_save;
39
99798ba4 40
7257a5d2 41/* Set the saved values of the command line arguments. */
42
43void
44set_args (int argc, char **argv)
45{
46 argc_save = argc;
47 argv_save = argv;
7257a5d2 48}
986d8637 49iexport(set_args);
7257a5d2 50
51
52/* Retrieve the saved values of the command line arguments. */
53
54void
55get_args (int *argc, char ***argv)
56{
57 *argc = argc_save;
58 *argv = argv_save;
59}
60
61
4ee9c684 62/* Initialize the runtime library. */
63
64static void __attribute__((constructor))
65init (void)
66{
4ee9c684 67 /* Must be first */
68 init_variables ();
69
70 init_units ();
7066f1c8 71
72 /* If (and only if) the user asked for it, set up the FPU state. */
73 if (options.fpe != 0)
74 set_fpu ();
75
64fc3c4c 76 init_compile_options ();
4ee9c684 77}
78
79
80/* Cleanup the runtime library. */
81
82static void __attribute__((destructor))
dddf4412 83cleanup (void)
4ee9c684 84{
85 close_units ();
86}