diagnostics: treat obsolete %define variable names as obsolete directives

Instead of

  warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]

display (in -fno-caret mode):

  warning: deprecated directive: '%define namespace foo', use '%define api.namespace foo' [-Wdeprecated]

and (in -fcaret mode):

  warning: deprecated directive, use '%define api.namespace toto' [-Wdeprecated]
   %define namespace toto
           ^^^^^^^^^

This is in preparation of cases where not only the variable is
renamed, but the values are too:

  warning: deprecated directive: '%define variant', use '%define api.value.type variant' [-Wdeprecated]

* src/muscle-tab.c (define_directive): New.
(muscle_percent_variable_update): Take the value as argument, and use it
in the diagnostics.
Loop with a pointer instead of an index.
* tests/input.at (%define backward compatibility): Adjust.
This commit is contained in:
Akim Demaille
2012-12-15 22:14:16 +01:00
parent 1dc927a7d4
commit 53f8e4096d
2 changed files with 29 additions and 14 deletions

View File

@@ -1336,7 +1336,7 @@ AT_DATA([[input.y]],
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-21: warning: deprecated %define variable name: 'api.push_pull', use 'api.push-pull' [-Wdeprecated]
[[input.y:1.9-21: warning: deprecated directive: '%define api.push_pull neither', use '%define api.push-pull neither' [-Wdeprecated]
input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
input.y:1.9-21: accepted value: 'pull'
input.y:1.9-21: accepted value: 'push'
@@ -1344,7 +1344,7 @@ input.y:1.9-21: accepted value: 'both'
]])
AT_BISON_CHECK([[-fcaret input.y]], [1], [],
[[input.y:1.9-21: warning: deprecated %define variable name: 'api.push_pull', use 'api.push-pull' [-Wdeprecated]
[[input.y:1.9-21: warning: deprecated directive, use '%define api.push-pull neither' [-Wdeprecated]
%define api.push_pull "neither"
^^^^^^^^^^^^^
input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
@@ -1361,7 +1361,7 @@ AT_DATA([[input.y]],
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-state' [-Wdeprecated]
[[input.y:1.9-34: warning: deprecated directive: '%define lr.keep_unreachable_states maybe', use '%define lr.keep-unreachable-state maybe' [-Wdeprecated]
input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-state'
]])
@@ -1372,7 +1372,7 @@ AT_DATA([[input.y]],
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[[input.y:1.9-17: warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]
[[input.y:1.9-17: warning: deprecated directive: '%define namespace foo', use '%define api.namespace foo' [-Wdeprecated]
input.y:2.9-21: error: %define variable 'api.namespace' redefined
input.y:1.9-17: previous definition
]])