1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Compiling - fix warnings with MSVC 17.14

New warnings come from 3 places

1. Warning C5287: Warning comes from json_lib.c from code like
  compile_time_assert((int) JSON_VALUE_NULL == (int) JSV_NULL);
2. Warning C5287: Similar warning come from wc_static_assert() from code
  in wolfSSL's header file
3. Warning C5286 in WolfSSL code, -enum_value

   (i.e multiplying enum with -1)is used

To fix:
- Disable warnings in WolfSSL code, using /wd<num> flag.
- workaround warning for users of WolfSSL, disable
  wc_static_assert() with -DWC_NO_STATIC_ASSERT compile flag
- Rewrite some compile_time_assert in json_lib.c to avoid warning.
- add target_link_libraries(vio ${SSL_LIBRARIES}) so that
  vio picks up -DWC_NO_STATIC_ASSERT
This commit is contained in:
Vladislav Vaintroub
2025-05-26 16:26:03 +02:00
parent 8a4d3a044f
commit aba04c562b
3 changed files with 10 additions and 8 deletions

View File

@@ -1788,13 +1788,13 @@ static enum json_types smart_read_value(json_engine_t *je,
*value_len= (int) ((char *) je->s.c_str - *value);
}
compile_time_assert((int) JSON_VALUE_OBJECT == (int) JSV_OBJECT);
compile_time_assert((int) JSON_VALUE_ARRAY == (int) JSV_ARRAY);
compile_time_assert((int) JSON_VALUE_STRING == (int) JSV_STRING);
compile_time_assert((int) JSON_VALUE_NUMBER == (int) JSV_NUMBER);
compile_time_assert((int) JSON_VALUE_TRUE == (int) JSV_TRUE);
compile_time_assert((int) JSON_VALUE_FALSE == (int) JSV_FALSE);
compile_time_assert((int) JSON_VALUE_NULL == (int) JSV_NULL);
compile_time_assert((enum json_types)JSON_VALUE_OBJECT == JSV_OBJECT);
compile_time_assert((enum json_types)JSON_VALUE_ARRAY == JSV_ARRAY);
compile_time_assert((enum json_types)JSON_VALUE_STRING == JSV_STRING);
compile_time_assert((enum json_types)JSON_VALUE_NUMBER == JSV_NUMBER);
compile_time_assert((enum json_types)JSON_VALUE_TRUE == JSV_TRUE);
compile_time_assert((enum json_types)JSON_VALUE_FALSE == JSV_FALSE);
compile_time_assert((enum json_types)JSON_VALUE_NULL == JSV_NULL);
return (enum json_types) je->value_type;