This is an archive of the discontinued LLVM Phabricator instance.

[libc] Fix various -Wconversion warnings in strto*l test code.
ClosedPublic

Authored by mcgrathr on Aug 26 2021, 7:06 PM.

Details

Summary

The Fuchsia build compiles the libc and test code with lots
of warnings enabled, including all the integer conversion warnings.
There was some sloppy type usage here that triggered some of those.

Diff Detail

Event Timeline

mcgrathr created this revision.Aug 26 2021, 7:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2021, 7:06 PM
mcgrathr requested review of this revision.Aug 26 2021, 7:06 PM
michaelrj added inline comments.Aug 27 2021, 10:12 AM
libc/test/src/stdlib/strtol_test.cpp
164

If you're changing the types of base and the digits then you also have to add a cast to the appropriate type on each of the ASSERT_EQs in the loops, since if the base types are int then the resulting type will also be int, which won't match the type of the output of the functions.

mcgrathr updated this revision to Diff 369156.Aug 27 2021, 11:51 AM

add more casts

mcgrathr marked an inline comment as done.Aug 27 2021, 11:51 AM
This revision is now accepted and ready to land.Aug 27 2021, 1:42 PM