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)
Sun, Nov 2, 9:29 PM
Unknown Object (File)
Sun, Oct 26, 9:20 PM
Unknown Object (File)
Sun, Oct 26, 9:20 PM
Unknown Object (File)
Sun, Oct 26, 3:48 PM
Unknown Object (File)
Sep 7 2025, 4:36 AM
Unknown Object (File)
Sep 7 2025, 1:21 AM
Unknown Object (File)
Jul 2 2025, 5:57 AM
Unknown Object (File)
Jul 1 2025, 1:47 PM
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