- if (! (l->action_props.is_value_used
- || !symbol_should_be_used (l)
- /* The default action, $$ = $1, `uses' both. */
- || (!r->action_props.code && (n == 0 || n == 1))))
- {
- if (n)
- warn_at (r->location, _("unused value: $%d"), n);
- else
- warn_at (r->location, _("unset value: $$"));
- }
+ {
+ bool midrule_warning = false;
+ if (!l->action_props.is_value_used
+ && symbol_should_be_used (l, &midrule_warning)
+ /* The default action, $$ = $1, `uses' both. */
+ && (r->action_props.code || (n != 0 && n != 1)))
+ {
+ warnings warn_flag = midrule_warning ? Wmidrule_values : Wother;
+ if (n)
+ complain_at (r->location, warn_flag, _("unused value: $%d"), n);
+ else
+ complain_at (r->location, warn_flag, _("unset value: $$"));
+ }
+ }