Project

General

Profile

Bug #853423

strvec_index_valid() -Wtype-limits compiler warning

Added by Marko Lindqvist 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
General
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

When -Wtype-limits warnings enabled:

../../../src/utility/string_vector.c: In function ‘strvec_index_valid’:
../../../src/utility/string_vector.c:382:18: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
382 | return svindex >= 0 && svindex < psv->size;

History

#1 Updated by Marko Lindqvist 5 months ago

#2 Updated by Marko Lindqvist 5 months ago

  • Target version changed from 2.6.2 to 3.0.0

#3 Updated by Marko Lindqvist 5 months ago

I've been postponing pushing this patch as it's somewhat counter-productive. Though the check is currently pointless (as the warning says), it protects against potential future code changes where the type of the argument changes to a signed one.
Now that I've fixed most of the type-limits warnings, it has turned out that there is just two of these 'counter-productive' cases (this and one other). I think it's worth fixing warnings in these two cases despite the cons, as that would mean clean build with type-limits warnings enabled, and we could actually enable them by default on --enable-debug builds.

#4 Updated by Marko Lindqvist 5 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF