summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2024-02-08 09:41:23 +0000
committerHugo Landau <hlandau@openssl.org>2024-02-09 11:03:52 +0000
commit1260d0f5792b5253ecd8ca23eee848ab2c50c1ea (patch)
tree0ccd5b9956e504f86e46df9064a7a23e3b601479 /test
parent2b5a5c87df23ee5b0344197174bf1219b04d2ebe (diff)
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')
-rw-r--r--test/json_test.c4
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)