@@ -38,36 +38,57 @@ for (i = 0; i < n_langs; i++) {
for (i = 0; i < n_opts; i++) {
enabledby_arg = opt_args("EnabledBy", flags[i]);
if (enabledby_arg != "") {
- n_enabledby_names = split(enabledby_arg, enabledby_names, " && ");
- if (n_enabledby_names > 2) {
- print "#error EnabledBy (Wfoo && Wbar && Wbaz) not currently supported"
- }
- for (j = 1; j <= n_enabledby_names; j++) {
- enabledby_name = enabledby_names[j];
- enabledby_index = opt_numbers[enabledby_name];
- if (enabledby_index == "") {
- print "#error Enabledby: " enabledby_name
- } else {
- condition = "";
- if (n_enabledby_names == 2) {
- opt_var_name_1 = search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts);
- opt_var_name_2 = search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts);
- if (opt_var_name_1 == "") {
- print "#error " enabledby_names[1] " does not have a Var() flag"
+ if (index(enabledby_arg, " && ") == 0) {
+ # Enabledby(arg) or Enabledby(arg1 || arg2 || arg3)
+ n_enabledby_names = split(enabledby_arg, enabledby_names, " \\|\\| ");
+ for (j = 1; j <= n_enabledby_names; j++) {
+ enabledby_name = enabledby_names[j];
+ enabledby_index = opt_numbers[enabledby_name];
+ if (enabledby_index == "") {
+ print "#error Enabledby: " enabledby_name
+ } else {
+ condition = "";
+ if (enables[enabledby_name] == "") {
+ enabledby[n_enabledby] = enabledby_name;
+ n_enabledby++;
}
- if (opt_var_name_2 == "") {
- print "#error " enabledby_names[2] " does not have a Var() flag"
- }
- condition = "opts->x_" opt_var_name_1 " && opts->x_" opt_var_name_2;
+ enables[enabledby_name] = enables[enabledby_name] opts[i] ";";
+ enablesif[enabledby_name] = enablesif[enabledby_name] condition ";";
}
- if (enables[enabledby_name] == "") {
- enabledby[n_enabledby] = enabledby_name;
- n_enabledby++;
+ }
+ } else {
+ # Enabledby(arg1 && arg2)
+ n_enabledby_names = split(enabledby_arg, enabledby_names, " && ");
+ if (n_enabledby_names > 2) {
+ print "#error EnabledBy (Wfoo && Wbar && Wbaz) not currently supported"
+ }
+ for (j = 1; j <= n_enabledby_names; j++) {
+ enabledby_name = enabledby_names[j];
+ enabledby_index = opt_numbers[enabledby_name];
+ if (enabledby_index == "") {
+ print "#error Enabledby: " enabledby_name
+ } else {
+ condition = "";
+ if (n_enabledby_names == 2) {
+ opt_var_name_1 = search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts);
+ opt_var_name_2 = search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts);
+ if (opt_var_name_1 == "") {
+ print "#error " enabledby_names[1] " does not have a Var() flag"
+ }
+ if (opt_var_name_2 == "") {
+ print "#error " enabledby_names[2] " does not have a Var() flag"
+ }
+ condition = "opts->x_" opt_var_name_1 " && opts->x_" opt_var_name_2;
+ }
+ if (enables[enabledby_name] == "") {
+ enabledby[n_enabledby] = enabledby_name;
+ n_enabledby++;
+ }
+ enables[enabledby_name] = enables[enabledby_name] opts[i] ";";
+ enablesif[enabledby_name] = enablesif[enabledby_name] condition ";";
}
- enables[enabledby_name] = enables[enabledby_name] opts[i] ";";
- enablesif[enabledby_name] = enablesif[enabledby_name] condition ";";
}
- }
+ }
}
enabledby_arg = opt_args("LangEnabledBy", flags[i]);