Need way to test code for undefined diagnostic keys
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Released
|
Medium
|
Paul J. Lucas |
Bug Description
Bug 1044245 is about an assertion failure that occurs when an error is thrown using a localization key that is not defined in diagnostics_en.xml. What we need is an automated way to ensure that such keys are not added to the codebase.
If there was an efficient way to create a list of all keys referenced by the code, it would be easy to use XQuery to join this with diagnostics_en.xml and point out any misses. Can a way be devised to create this list, preferably including filenames and line numbers? For instance, are all errors thrown using C macros, and if so, could those macros (in debug mode) do anything to help produce this list? Or are there code-parsing tools (clang?) that would let us identify all such keys?
Related branches
- Matthias Brantner: Approve
- Markos Zaharioudakis: Approve
- Paul J. Lucas: Approve
-
Diff: 1826 lines (+769/-163)31 files modifiedinclude/zorba/internal/diagnostic.h (+6/-5)
include/zorba/pregenerated/diagnostic_list.h (+2/-0)
modules/org/jsoniq/www/pregenerated/errors.xq (+8/-0)
src/compiler/translator/translator.cpp (+5/-5)
src/context/static_context.cpp (+1/-1)
src/diagnostics/CMakeLists.txt (+16/-5)
src/diagnostics/diagnostic.h (+31/-5)
src/diagnostics/diagnostic_en.xml (+102/-33)
src/diagnostics/dict.h (+3/-1)
src/diagnostics/dict_zed_keys_h.xq (+55/-0)
src/diagnostics/pregenerated/diagnostic_list.cpp (+3/-0)
src/diagnostics/pregenerated/dict_en.cpp (+45/-37)
src/diagnostics/pregenerated/dict_zed_keys.h (+338/-0)
src/runtime/core/apply_updates.cpp (+35/-19)
src/runtime/core/fncall_iterator.cpp (+1/-1)
src/runtime/core/sequencetypes.cpp (+7/-8)
src/runtime/function_item/dynamic_fncall_iterator.cpp (+3/-3)
src/runtime/json/jsoniq_functions_impl.cpp (+2/-2)
src/runtime/numerics/numerics_impl.cpp (+1/-1)
src/store/naive/node_items.cpp (+2/-1)
src/store/naive/pul_primitives.cpp (+59/-26)
src/store/naive/store.cpp (+1/-1)
src/util/error_util.cpp (+2/-2)
src/util/fs_util.h (+31/-0)
test/rbkt/ExpQueryResults/zorba/index/auctions2u.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/index/undo1.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_06.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/obj_constr_10.xml.res (+1/-1)
test/rbkt/ExpQueryResults/zorba/jsoniq/serializer-JNSE0022.xml.res (+1/-1)
test/rbkt/Queries/zorba/index/auctions2u.xq (+1/-1)
test/rbkt/Queries/zorba/index/undo1.xq (+4/-1)
Changed in zorba: | |
assignee: | nobody → Paul J. Lucas (paul-lucas) |
importance: | Undecided → Medium |
Changed in zorba: | |
status: | New → In Progress |
Changed in zorba: | |
status: | In Progress → Fix Committed |
Changed in zorba: | |
status: | Fix Committed → Fix Released |
I'm changing things such that any key reference via the ZED() macro (which is all of them, AFAIK) *must* be defined in the XML file otherwise a C++ compile-time error will be given.