1 /* params.c - Run-time parameters.
2 Copyright (C) 2001 Free Software Foundation, Inc.
3 Written by Mark Mitchell <mark@codesourcery.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 #include "coretypes.h"
31 /* An array containing the compiler parameters and their current
34 param_info
*compiler_params
;
36 /* The number of entries in the table. */
38 static size_t num_compiler_params
;
40 /* Add the N PARAMS to the current list of compiler parameters. */
43 add_params (params
, n
)
44 const param_info params
[];
47 /* Allocate enough space for the new parameters. */
50 xrealloc (compiler_params
,
51 (num_compiler_params
+ n
) * sizeof (param_info
)));
52 /* Copy them into the table. */
53 memcpy (compiler_params
+ num_compiler_params
,
55 n
* sizeof (param_info
));
56 /* Keep track of how many parameters we have. */
57 num_compiler_params
+= n
;
60 /* Set the VALUE associated with the parameter given by NAME. */
63 set_param_value (name
, value
)
69 /* Make sure nobody tries to set a parameter to an invalid value. */
70 if (value
== INVALID_PARAM_VAL
)
73 /* Scan the parameter table to find a matching entry. */
74 for (i
= 0; i
< num_compiler_params
; ++i
)
75 if (strcmp (compiler_params
[i
].option
, name
) == 0)
77 compiler_params
[i
].value
= value
;
81 /* If we didn't find this parameter, issue an error message. */
82 error ("invalid parameter `%s'", name
);