]> gcc.gnu.org Git - gcc.git/blame - gcc/params.c
* mangle.c (get_identifier_nocopy): Add cast.
[gcc.git] / gcc / params.c
CommitLineData
c6d9a88c 1/* params.c - Run-time parameters.
3d7aafde 2 Copyright (C) 2001, 2003 Free Software Foundation, Inc.
c6d9a88c
MM
3 Written by Mark Mitchell <mark@codesourcery.com>.
4
1322177d 5This file is part of GCC.
c6d9a88c 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
c6d9a88c 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
c6d9a88c
MM
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA.
c6d9a88c
MM
21
22*/
23
24#include "config.h"
25#include "system.h"
4977bab6
ZW
26#include "coretypes.h"
27#include "tm.h"
c6d9a88c
MM
28#include "params.h"
29#include "toplev.h"
30
31/* An array containing the compiler parameters and their current
32 values. */
33
34param_info *compiler_params;
35
36/* The number of entries in the table. */
37
38static size_t num_compiler_params;
39
40/* Add the N PARAMS to the current list of compiler parameters. */
41
6a4d6760 42void
3d7aafde 43add_params (const param_info params[], size_t n)
c6d9a88c
MM
44{
45 /* Allocate enough space for the new parameters. */
703ad42b
KG
46 compiler_params = xrealloc (compiler_params,
47 (num_compiler_params + n) * sizeof (param_info));
c6d9a88c
MM
48 /* Copy them into the table. */
49 memcpy (compiler_params + num_compiler_params,
50 params,
51 n * sizeof (param_info));
52 /* Keep track of how many parameters we have. */
53 num_compiler_params += n;
54}
55
56/* Set the VALUE associated with the parameter given by NAME. */
57
58void
3d7aafde 59set_param_value (const char *name, int value)
c6d9a88c
MM
60{
61 size_t i;
62
63 /* Make sure nobody tries to set a parameter to an invalid value. */
64 if (value == INVALID_PARAM_VAL)
65 abort ();
66
67 /* Scan the parameter table to find a matching entry. */
68 for (i = 0; i < num_compiler_params; ++i)
69 if (strcmp (compiler_params[i].option, name) == 0)
70 {
71 compiler_params[i].value = value;
72 return;
73 }
74
75 /* If we didn't find this parameter, issue an error message. */
76 error ("invalid parameter `%s'", name);
77}
This page took 1.239557 seconds and 5 git commands to generate.