diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2012-11-07 18:11:01 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2012-11-07 18:11:01 +0000 |
commit | 0829c7f7c5210cd1581042115cfe95c97283f44c (patch) | |
tree | c8daa5684552755ccd4662c7ed9d7f1b7d8ea663 /gcc/opt-functions.awk | |
parent | 34a180a642af3c0b5ad145e1a0b228d71933d6ba (diff) | |
download | gcc-0829c7f7c5210cd1581042115cfe95c97283f44c.zip gcc-0829c7f7c5210cd1581042115cfe95c97283f44c.tar.gz gcc-0829c7f7c5210cd1581042115cfe95c97283f44c.tar.bz2 |
optc-gen.awk: Factor code out to...
2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* optc-gen.awk: Factor code out to...
* opt-functions.awk (lang_enabled_by): ... this new function.
From-SVN: r193303
Diffstat (limited to 'gcc/opt-functions.awk')
-rw-r--r-- | gcc/opt-functions.awk | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index 13de5e4..4a81e88 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -313,3 +313,35 @@ function search_var_name(name, opt_numbers, opts, flags, n_opts) } return "" } + +# Handle LangEnabledBy(ENABLED_BY_LANGS, ENABLEDBY_NAME, ENABLEDBY_POSARG, +# ENABLEDBY_NEGARG). This function does not return anything. +function lang_enabled_by(enabledby_langs, enabledby_name, enabledby_posarg, enabledby_negarg) +{ + n_enabledby_arg_langs = split(enabledby_langs, enabledby_arg_langs, " "); + enabledby_index = opt_numbers[enabledby_name]; + if (enabledby_index == "") { + print "#error LangEnabledby: " enabledby_name + } else { + if (enabledby_posarg != "" && enabledby_negarg != "") { + with_args = "," enabledby_posarg "," enabledby_negarg + } else if (enabledby_posarg == "" && enabledby_negarg == "") { + with_args = "" + } else { + print "#error LangEnabledBy("enabledby_langs","enabledby_name", " \ + enabledby_posarg", " enabledby_negargs \ + ") with three arguments, it should have either 2 or 4" + } + + for (j = 1; j <= n_enabledby_arg_langs; j++) { + lang_name = lang_sanitized_name(enabledby_arg_langs[j]); + lang_index = lang_numbers[enabledby_arg_langs[j]]; + if (enables[lang_name,enabledby_name] == "") { + enabledby[lang_name,n_enabledby_lang[lang_index]] = enabledby_name; + n_enabledby_lang[lang_index]++; + } + enables[lang_name,enabledby_name] = enables[lang_name,enabledby_name] opts[i] with_args ";"; + } + } +} + |