]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgfortran/runtime/main.c
Update copyright years.
[thirdparty/gcc.git] / libgfortran / runtime / main.c
CommitLineData
a945c346 1/* Copyright (C) 2002-2024 Free Software Foundation, Inc.
6de9cd9a
DN
2 Contributed by Andy Vaught and Paul Brook <paul@nowt.org>
3
d30fe1c5 4This file is part of the GNU Fortran runtime library (libgfortran).
6de9cd9a 5
57dea9f6 6Libgfortran is free software; you can redistribute it and/or modify
6de9cd9a 7it under the terms of the GNU General Public License as published by
748086b7 8the Free Software Foundation; either version 3, or (at your option)
6de9cd9a
DN
9any later version.
10
57dea9f6 11Libgfortran is distributed in the hope that it will be useful,
6de9cd9a
DN
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
748086b7
JJ
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/>. */
6de9cd9a 24
36ae8a61 25#include "libgfortran.h"
6de9cd9a 26
6de9cd9a 27
f2ae4b2b
FXC
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
6de9cd9a
DN
36
37static int argc_save;
38static char **argv_save;
39
868d75db 40
092231a8
TB
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;
092231a8 48}
fa10ccb2 49iexport(set_args);
092231a8
TB
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
6de9cd9a
DN
62/* Initialize the runtime library. */
63
64static void __attribute__((constructor))
65init (void)
66{
6de9cd9a
DN
67 /* Must be first */
68 init_variables ();
69
70 init_units ();
c2cc83bc
FXC
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
8b67b708 76 init_compile_options ();
6de9cd9a
DN
77}
78
79
80/* Cleanup the runtime library. */
81
82static void __attribute__((destructor))
4b6903ec 83cleanup (void)
6de9cd9a
DN
84{
85 close_units ();
86}