You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compilation warning arise in ezxml.c for gcc-7 compiler to compare between signed integer(-1) and unsigned variable (root->len) within function void ezxml_free(ezxml_t xml).
It raises an -Wsign-compare warning in gcc-7.
Steps to reproduce
The environment is under CentOS Linux release 7.9.2009 (Core), with gcc (GCC) 7.3.0.
Compilation rules were defined as below, with ezxml.h located in ${PROJECT_BINARY_DIR} and ezxml.c in the same directory with CMakeList.txt. ( same with #6 )
[ 85%] Building C object cli/CMakeFiles/ezxml.c.o
/home/cli/ezxml.c: In function 'ezxml_free':
/home/cli/ezxml.c:813:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (root->len == -1) free(root->m);
^
Possible fixes
My suggestion would be add a type conversion such as
if (root->len == (unsigned int)-1) free(root->m); // malloced xml data
Instead of
if (root->len == -1) free(root->m); // malloced xml data
Labels
/label ~bug ~reproduced ~needs-investigation
The text was updated successfully, but these errors were encountered:
Summary
Compilation warning arise in
ezxml.c
for gcc-7 compiler to compare between signed integer(-1
) and unsigned variable (root->len
) within functionvoid ezxml_free(ezxml_t xml)
.It raises an -Wsign-compare warning in gcc-7.
Steps to reproduce
The environment is under CentOS Linux release 7.9.2009 (Core), with gcc (GCC) 7.3.0.
Compilation rules were defined as below, with ezxml.h located in ${PROJECT_BINARY_DIR} and ezxml.c in the same directory with CMakeList.txt. ( same with #6 )
What is the current bug(warning) behavior?
gcc shows warning as below:
Possible fixes
My suggestion would be add a type conversion such as
Instead of
Labels
/label ~bug ~reproduced ~needs-investigation
The text was updated successfully, but these errors were encountered: