summaryrefslogtreecommitdiff
path: root/gcc/params.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 16:46:25 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 16:46:25 +0000
commit1d8a53f4d7d045d285e9ef482f6b18caea9005f4 (patch)
tree68b4dba3e71746f5a25ddc90900e8d44323f79f8 /gcc/params.c
parentdd1d31096c2b5057c5736cbbf6ce85ff26f69098 (diff)
downloadgcc-1d8a53f4d7d045d285e9ef482f6b18caea9005f4.tar.gz
PR middle-end/18667
* params.c (set_param_value): Add range check. * params.def: Add min and max values. Reformat long strings. * params.h (struct param_info): Add min and max fields. (enum compiler_param): Adjust DEFPARAM. * toplev.c (lang_independent_params): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91567 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/params.c')
-rw-r--r--gcc/params.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/params.c b/gcc/params.c
index b0dc375ae4a..cc55fae6f67 100644
--- a/gcc/params.c
+++ b/gcc/params.c
@@ -68,7 +68,17 @@ set_param_value (const char *name, int value)
for (i = 0; i < num_compiler_params; ++i)
if (strcmp (compiler_params[i].option, name) == 0)
{
- compiler_params[i].value = value;
+ if (value < compiler_params[i].min_value)
+ error ("minimum value of parameter %qs is %u",
+ compiler_params[i].option,
+ compiler_params[i].min_value);
+ else if (compiler_params[i].max_value > compiler_params[i].min_value
+ && value > compiler_params[i].max_value)
+ error ("maximum value of parameter %qs is %u",
+ compiler_params[i].option,
+ compiler_params[i].max_value);
+ else
+ compiler_params[i].value = value;
return;
}