annotate fixincludes/fixopts.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Handle options that are passed from environment variables.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
111
kono
parents: 0
diff changeset
3 Copyright (C) 2004, 2009, 2012 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "fixlib.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
111
kono
parents: 0
diff changeset
23 te_verbose verbose_level = VERB_PROGRESS;
kono
parents: 0
diff changeset
24
kono
parents: 0
diff changeset
25 fixinc_mode_t fixinc_mode = TESTING_OFF;
kono
parents: 0
diff changeset
26
kono
parents: 0
diff changeset
27 #define _ENV_(v,m,n,t) char const * v = NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 ENV_TABLE
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 #undef _ENV_
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
111
kono
parents: 0
diff changeset
31 static void
kono
parents: 0
diff changeset
32 show_not_def (char const * vname)
kono
parents: 0
diff changeset
33 {
kono
parents: 0
diff changeset
34 static const char var_not_found[] =
kono
parents: 0
diff changeset
35 "fixincl ERROR: %s environment variable not defined\n"
kono
parents: 0
diff changeset
36 "each of these must be defined:\n";
kono
parents: 0
diff changeset
37 static char const not_found_var[] = "\t%s\n";
kono
parents: 0
diff changeset
38
kono
parents: 0
diff changeset
39 fprintf (stderr, var_not_found, vname);
kono
parents: 0
diff changeset
40 # define _ENV_(vv,mm,nn,tt) \
kono
parents: 0
diff changeset
41 if (mm) fprintf (stderr, not_found_var, nn);
kono
parents: 0
diff changeset
42 ENV_TABLE
kono
parents: 0
diff changeset
43 # undef _ENV_
kono
parents: 0
diff changeset
44
kono
parents: 0
diff changeset
45 exit (EXIT_FAILURE);
kono
parents: 0
diff changeset
46 }
kono
parents: 0
diff changeset
47
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 void
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 initialize_opts (void)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 {
111
kono
parents: 0
diff changeset
51 #define _ENV_(v,m,n,t) { \
kono
parents: 0
diff changeset
52 static char const var[] = n; \
kono
parents: 0
diff changeset
53 v = getenv (var); \
kono
parents: 0
diff changeset
54 if (m && (v == NULL)) show_not_def (var); \
kono
parents: 0
diff changeset
55 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
111
kono
parents: 0
diff changeset
57 ENV_TABLE;
kono
parents: 0
diff changeset
58 #undef _ENV_
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
111
kono
parents: 0
diff changeset
60 if ((pz_test_mode != NULL) && (strcmp (pz_test_mode, "true") == 0))
kono
parents: 0
diff changeset
61 fixinc_mode = TESTING_ON;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 }