mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-06 23:52:44 +00:00
Fixed issue with pointer comparisons in prettyasserts.py
We end up passing intmax_t pointers around, but without a cast. This results in a warning. Adding a cast fixes the warning. This is in the printing logic, not the actual comparison, so hiding warnings with this cast is not a concern here. I also flipped the type we compare with to use the right-hand side. The pretty-assert code already treats the right-hand as the "expected" value (I wonder if this is an english language quirk), so I think it makes sense to use the right-hand side as the "expected" type.
This commit is contained in:
@@ -144,15 +144,15 @@ def write_header(f, limit=LIMIT):
|
|||||||
for op, cmp in sorted(CMP.items()):
|
for op, cmp in sorted(CMP.items()):
|
||||||
f.writeln("#define __PRETTY_ASSERT_INT_%s(lh, rh) do { \\"
|
f.writeln("#define __PRETTY_ASSERT_INT_%s(lh, rh) do { \\"
|
||||||
% cmp.upper())
|
% cmp.upper())
|
||||||
f.writeln(" __typeof__(lh) _lh = lh; \\")
|
f.writeln(" __typeof__(rh) _lh = lh; \\")
|
||||||
f.writeln(" __typeof__(lh) _rh = rh; \\")
|
f.writeln(" __typeof__(rh) _rh = rh; \\")
|
||||||
f.writeln(" if (!(_lh %s _rh)) { \\" % op)
|
f.writeln(" if (!(_lh %s _rh)) { \\" % op)
|
||||||
f.writeln(" __pretty_assert_fail( \\")
|
f.writeln(" __pretty_assert_fail( \\")
|
||||||
f.writeln(" __FILE__, __LINE__, \\")
|
f.writeln(" __FILE__, __LINE__, \\")
|
||||||
f.writeln(" __pretty_assert_print_int, \"%s\", \\"
|
f.writeln(" __pretty_assert_print_int, \"%s\", \\"
|
||||||
% cmp)
|
% cmp)
|
||||||
f.writeln(" &(intmax_t){_lh}, 0, \\")
|
f.writeln(" &(intmax_t){(intmax_t)_lh}, 0, \\")
|
||||||
f.writeln(" &(intmax_t){_rh}, 0); \\")
|
f.writeln(" &(intmax_t){(intmax_t)_rh}, 0); \\")
|
||||||
f.writeln(" } \\")
|
f.writeln(" } \\")
|
||||||
f.writeln("} while (0)")
|
f.writeln("} while (0)")
|
||||||
for op, cmp in sorted(CMP.items()):
|
for op, cmp in sorted(CMP.items()):
|
||||||
|
|||||||
Reference in New Issue
Block a user