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)
Tue, Dec 10, 5:43 PM
Unknown Object (File)
Nov 21 2024, 1:34 AM
Unknown Object (File)
Nov 20 2024, 9:01 AM
Unknown Object (File)
Sep 16 2024, 8:14 AM
Unknown Object (File)
Sep 8 2024, 11:36 PM
Unknown Object (File)
Jul 17 2024, 2:58 AM
Unknown Object (File)
Jul 13 2024, 1:28 PM
Unknown Object (File)
Jul 2 2024, 10:07 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