Consolidates the two copies of comperr.h (they were identical) and
moves to a common folder. Updates all references to comperr.h, except
for one github commit ref.
If kmcmplib build includes the --full-test flag, then configure and run
tests that include pulling in the keyboards repo; otherwise skip all of
that.
This will require CI changes to run full tests, relating to #8361.
Fixes#8615.
The msgproc was never being located as we were missing the UTF8ToString
wrapper for the context.
This also ensures error message codes are emitted in hexadecimal, and
that the return value from the msgproc callback is 1, meaning 'continue
build'.
* Splits compiler interface functions that return bool into
CompilerInterfaces.cpp, and moves `SetError` define to that unit so
it can't be used accidentally elsewhere
* Audit of `AddWarning` calls and only those that are used in bool
functions now `return FALSE` (with new `AddWarningBool`) whereas all
others `return CERR_Break`
Decided to use the name `baseline` for this set of tests. They can be
used by any project in the repo now. Tests will be treated as shared,
and not modified (except in the case of a buggy test).
* Moves .kmn files, add `&NAME` line (don't use meson templating for
these files)
* Generates reference .kmx files using kmcomp for use as a baseline with
kmcmplib (kmc) tests, and for linux tests
* Updates references in core, kmcmplib, and linux builds
* Renames all the .kmn / .kmx to use a standardized, clean name format
(this was needed for building packages in the core tests)
During the configure phase for kmcmplib, we'll now always make a clone
of the keyboards repo so that we can checkout the specific commit we
want without making a mess of the user's environment. This is a little
slower (about 30 seconds to do a full local clone, a couple of minutes
for a remote clone) but a whole lot safer.
This only needs to be done in the `configure` action.
This also simplifies our scripts because we no longer need to pass any
option into meson for the keyboards repo, as we'll always know it is in
tests/keyboards.
Note: unit tests require manual build of keyboards in keyboards repo
using kmcmpdll.dll under Windows, and copying into the tests/fixtures
folder, prior to run, under non-Windows platforms.
(Later: will make it possible to build the reference keyboards using
kmcomp.exe on Windows.)
* fixes CheckFilenameConsistency to use Windows functions on Windows,
to check case differences, and only test for file existence on other
platforms which are already case sensitive.
* fixes memory leaks in usage of `wstrtostr2`, and eliminated the
function altogether.
* avoided use of u16sprintf for error messages, as it seems not to be
working correctly (long term, eliminate altogether, use C++ string
formatting).
* fix memory leak and overwrite of token in compiler error message.
* remove debug logging and namespace from filesystem.cpp
Unrelated to kmcmplib:
* improved logs in kmcomp tests (these tests are running on kmcmplib),
so it is easier to diagnose failing tests.
Moves filesystem functionality into filesystem.cpp (it was partially
in kmx_u16.h previously), and adds cross-platform switches. This brings
us most of the way towards being able to run kmcompx under WASM and in
theory other platforms (yet to be tested).
This fixes two issues:
1. `COMP_KEY` structure had padding that was not always zeroed out.
Made this explicit.
2. Rule sorting could be inconsistent when re-sorting rules that
use `+ any() > ...`, which are expanded at compile time into multiple
rules, and which ended up with identical sort keys due to lack of
precision. This relates to #8381 but only adds differentiation for
the otherwise ambiguous rule sort keys, and does not fix that issue,
which requires further investigation.
This is not enough for building to WASM, but wanted to split out the
bigger changes into their own PRs. This is mostly busy-work.
One serious bug fixed:
* u16string_from_string was not converting from UTF-16 correctly
Apart from that, just tidies up a few bits and pieces in kmcmplib:
* type coercion for json-validator.cpp (probably already fixed upstream)
* cleanup of build scripts for new builder variable names
* various compatibility macros for MSVC vs clang
* safer math expressions
* file name casing in headers
* replacement of various ms-only std funcs
* removed some unused variables and consts
* tightened up search for keyboards to get only keyboards in /source/
folders (may be possible to improve further in the future?)