mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
This implements Mantis feature request #497. compiler/parse_goal.m: compiler/parse_dcg_goal.m: When we find that a disable_warnings scope contains an unrecognized warning name, generate a warning for it, and return this warning *alongside*, not *instead of*, the disable_warnings scope goal. This requires passing around not a maybe1(goal), as we have been doing till now, but a maybe2(goal, list(warning_spec)), so this change affects both (1) most of these two modules, and (2) most of the modules below. compiler/error_util.m: Provide warning_spec as a synonym for error_spec, to be used in situations like this where the "error_spec" is intended contain something with severity_warning. compiler/maybe_error.m: Provide some new utility predicates now needed in parse_goal.m and elsewhere. compiler/prog_item.m: Provide room in the representation of clauses for the warnings generated by parsing the clause body goal. compiler/add_class.m: compiler/add_clause.m: compiler/add_mutable_aux_preds.m: compiler/add_pragma_tabling.m: compiler/du_type_layout.m: compiler/get_dependencies.m: compiler/make_hlds_passes.m: compiler/parse_item.m: compiler/parse_tree_out_clause.m: compiler/prog_item_stats.m: compiler/superhomogeneous.m: Conform to the changes above. tests/valid/unknown_warning.m: Add this test case that checks whether a source file with an unknown warning name in a disable_warnings scope can have code generated for it. tests/warnings/unknown_warning.{m,exp}: Add the same source file to this directory as well, to check whether we get the right set of warnings. tests/valid/Mmakefile: tests/valid/Mercury.options: tests/warnings/Mmakefile: Enable the two new test cases.
7 lines
407 B
Plaintext
7 lines
407 B
Plaintext
unknown_warning.m:017: Warning: the first element of the list following the
|
|
unknown_warning.m:017: `disable_warning' keyword, `singleton_varx', is not
|
|
unknown_warning.m:017: the name of a warning, so the compiler cannot act on
|
|
unknown_warning.m:017: it.
|
|
unknown_warning.m:020: In clause for predicate `unknown_warning'/3:
|
|
unknown_warning.m:020: warning: variable `D' occurs only once in this scope.
|