diff options
author | Hugo Landau <hlandau@openssl.org> | 2024-02-08 10:41:23 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2024-02-09 12:03:52 +0100 |
commit | 1260d0f5792b5253ecd8ca23eee848ab2c50c1ea (patch) | |
tree | 0ccd5b9956e504f86e46df9064a7a23e3b601479 /test/json_test.c | |
parent | QUIC qlog: Enable qlog in Windows CI (diff) | |
download | openssl-1260d0f5792b5253ecd8ca23eee848ab2c50c1ea.tar.xz openssl-1260d0f5792b5253ecd8ca23eee848ab2c50c1ea.zip |
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)
Diffstat (limited to 'test/json_test.c')
-rw-r--r-- | test/json_test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/json_test.c b/test/json_test.c index d2c5059719..8cde1be2e3 100644 --- a/test/json_test.c +++ b/test/json_test.c @@ -128,8 +128,8 @@ typedef void (*fp_pz_type)(OSSL_JSON_ENC *, const void *, size_t); #define BEGIN_SCRIPT(name, title, flags) \ static const struct script_info *get_script_##name(void) \ { \ - const char *const script_name = #name; \ - const char *const script_title = #title; \ + static const char script_name[] = #name; \ + static const char script_title[] = #title; \ \ static const struct script_word script_words[] = { \ OP_INIT_FLAGS(flags) |