Page MenuHomeFreeBSD

Swap around test to defeat gcc 4.2's warning about i being unitialized
AbandonedPublic

Authored by dim on Apr 22 2017, 7:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 5 2024, 3:14 AM
Unknown Object (File)
Jan 21 2024, 10:33 PM
Unknown Object (File)
Jan 6 2024, 8:16 AM
Unknown Object (File)
Jan 6 2024, 8:16 AM
Unknown Object (File)
Jan 6 2024, 8:04 AM
Unknown Object (File)
Dec 25 2023, 3:02 AM
Unknown Object (File)
Dec 22 2023, 10:27 PM
Unknown Object (File)
Dec 20 2023, 4:44 AM
Subscribers

Details

Reviewers
bapt
emaste
Summary

Gcc 4.2 warns about the new diff:

usr.bin/diff/diffreg.c: In function 'change':
usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function

This warning is a little bogus, but indeed the way i is re-used in
this part of the function is a bit strange.

We can swap around the tests for diff_format being equal to D_EDIT
and i being zero, which fixes the warning.

Alternatively, we could just put i = 0 just above the previous if
statement. Let me know what you prefer.

Diff Detail