This is an archive of the discontinued LLVM Phabricator instance.

ObjectFileMachO: Silence signed/unsigned comparison warning
ClosedPublic

Authored by majnemer on Jul 22 2014, 4:17 PM.

Details

Summary

File::SeekFromStart returns an off_t representing the position of the
file after seeking. This return value is always going to be one of two
values: the input or -1 in the case of failure.

ObjectFileMachO compares an expression of type off_t from the return of
File::SeekFromStart(segment.fileoff) and compares it for equality with
segment.fileoff.

The type of segment_command_64::fileoff is unsigned while off_t is
signed, comparing them emits a diagnostic under GCC.

Instead, we can just compare SeekFromSTart with -1 to see if we
successfully seeked.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 11796.Jul 22 2014, 4:17 PM
majnemer retitled this revision from to ObjectFileMachO: Silence signed/unsigned comparison warning.
majnemer updated this object.
majnemer added reviewers: tfiala, zturner.
majnemer added a subscriber: Unknown Object (MLST).
majnemer closed this revision.Jul 23 2014, 5:32 PM
majnemer updated this revision to Diff 11829.

Closed by commit rL213822 (authored by @majnemer).