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
src/write.c:279:11: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
flags = flags;
~~~~~ ^ ~~~~~
gcc 12.1, on the other hand has no trouble with assigning a variable to itself, but doesn't like the use of strncpy() in src/query.c prepare_obj_list and prepare_obj_repl_list:
src/query.c: In function ‘prepare_obj_list’:
src/query.c:189:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
189 | strncpy(path1, path, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:182:18: note: length computed here
182 | size_t len = strlen(path) + 1;
| ^~~~~~~~~~~~
src/query.c:190:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
190 | strncpy(path2, path, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:182:18: note: length computed here
182 | size_t len = strlen(path) + 1;
| ^~~~~~~~~~~~
src/query.c: In function ‘prepare_obj_repl_list’:
src/query.c:285:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
285 | strncpy(path1, path, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:278:18: note: length computed here
278 | size_t len = strlen(path) + 1;
| ^~~~~~~~~~~~
src/query.c:286:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
286 | strncpy(path2, path, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:278:18: note: length computed here
278 | size_t len = strlen(path) + 1;
| ^~~~~~~~~~~~
These are arguably a false positive, but there isn't much sign of that being fixed. In both cases it looks like it would be easier to use strdup() though, which would fix the warnings and simplify the code a bit.
The text was updated successfully, but these errors were encountered:
While attempting some builds with recent compilers I got the following warnings:
clang 13 doesn't like this line:
gcc 12.1, on the other hand has no trouble with assigning a variable to itself, but doesn't like the use of
strncpy()
in src/query.cprepare_obj_list
andprepare_obj_repl_list
:These are arguably a false positive, but there isn't much sign of that being fixed. In both cases it looks like it would be easier to use
strdup()
though, which would fix the warnings and simplify the code a bit.The text was updated successfully, but these errors were encountered: