Closed sjanel closed 1 year ago
Latest jwt-cpp code produces following warning with -Wvla-extension:
jwt-cpp
-Wvla-extension
jwt-cpp-src/include/jwt-cpp/jwt.h:3045:14: warning: variable length arrays are a C99 feature [-Wvla-extension] char mb[MB_CUR_MAX]; ^~~~~~~~~~ /usr/include/stdlib.h:97:20: note: expanded from macro 'MB_CUR_MAX' #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ jwt-cpp-src/include/jwt-cpp/jwt.h:3045:14: note: non-constexpr function '__ctype_get_mb_cur_max' cannot be used in a constant expression /usr/include/stdlib.h:97:21: note: expanded from macro 'MB_CUR_MAX' #define MB_CUR_MAX (__ctype_get_mb_cur_max ()) ^ /usr/include/stdlib.h:98:15: note: declared here extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; ^ 1 warning generated.
The easiest way to fix it is to use MB_LEN_MAX instead of MB_CUR_MAX which is a rather low value anyway (16), and a compile time constant.
MB_LEN_MAX
MB_CUR_MAX
According to the documentation, MB_CUR_MAX maximum value (for all locales) is MB_LEN_MAX.
Latest
jwt-cpp
code produces following warning with-Wvla-extension
:The easiest way to fix it is to use
MB_LEN_MAX
instead ofMB_CUR_MAX
which is a rather low value anyway (16), and a compile time constant.According to the documentation,
MB_CUR_MAX
maximum value (for all locales) isMB_LEN_MAX
.