]> git.ipfire.org Git - thirdparty/openssl.git/commit - test/json_test.c
JSON_ENC: Fix unit test for MSVC
authorHugo Landau <hlandau@openssl.org>
Thu, 8 Feb 2024 09:41:23 +0000 (09:41 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 9 Feb 2024 11:03:52 +0000 (11:03 +0000)
commit1260d0f5792b5253ecd8ca23eee848ab2c50c1ea
tree0ccd5b9956e504f86e46df9064a7a23e3b601479
parent2b5a5c87df23ee5b0344197174bf1219b04d2ebe
JSON_ENC: Fix unit test for MSVC

Previously scripts were defined like this:

    {
        static const char *const script_name = "xxx";

        static const struct script_info script_info = {
            script_name, ...
        };

        return &script_info;
    }

MSVC cannot handle this, presumably because this technically involves a
load from a variable to determine that script_name equals "xxx" and it
is unable to do this during evaluation of a constant initializer list.
Resolve this by changing script_name and script_title to be arrays
instead, allowing the correct pointer values to be filled into
script_info as symbol addresses/relocations rather than dereferences.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23517)
test/json_test.c