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)
Fri, Mar 20, 5:32 AM
Unknown Object (File)
Wed, Mar 18, 5:53 AM
Unknown Object (File)
Tue, Mar 17, 3:24 AM
Unknown Object (File)
Feb 8 2026, 3:28 PM
Unknown Object (File)
Jan 31 2026, 4:47 AM
Unknown Object (File)
Jan 12 2026, 10:41 AM
Unknown Object (File)
Nov 29 2025, 1:22 AM
Unknown Object (File)
Nov 22 2025, 4:15 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