Clang creates a warning about unused variables which was discovered by HAPoxy community haproxy/haproxy#1868
One suggestion is to create a pragma for clang haproxy/haproxy#1868 (comment)
Another option is to add a new option like -D MJSON_DEBUG=1 and change the code accordingly.
Something like the code below instead of this block https://github.com/cesanta/mjson/blob/master/src/mjson.c#L186-L192.
static int plen1(const char *s) {
int i = 0;
#if MJSON_DEBUG
int n = 0;
#endif
while (s[i] != '\0' && s[i] != '.' && s[i] != '[') {
i += s[i] == '\\' ? 2 : 1;
#if MJSON_DEBUG
n++;
#endif
}
#if MJSON_DEBUG
printf("PLEN1: s: [%s], [%.*s] => %d\n", s, i, s, n);
#endif
return n;
}
As I would like to create a Pull Request to mjson and then add the new version to HAProxy please let me know what's your preferred way is to solve the clang warning.
Clang creates a warning about unused variables which was discovered by HAPoxy community haproxy/haproxy#1868
One suggestion is to create a pragma for clang haproxy/haproxy#1868 (comment)
Another option is to add a new option like
-D MJSON_DEBUG=1and change the code accordingly.Something like the code below instead of this block https://github.com/cesanta/mjson/blob/master/src/mjson.c#L186-L192.
As I would like to create a Pull Request to mjson and then add the new version to HAProxy please let me know what's your preferred way is to solve the clang warning.