This is an archive of the discontinued LLVM Phabricator instance.

Fix a gsym warning on Windows
AbandonedPublic

Authored by aganea on Oct 30 2019, 11:08 AM.

Details

Reviewers
clayborg
Summary

Use a 64-bit integer for Length instead of off_t which is defined as a long on Windows.

(from C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\sys\types.h)

#ifndef _OFF_T_DEFINED
    #define _OFF_T_DEFINED

    typedef long _off_t; // file offset value

    #if (defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || (!defined _CRT_DECLARE_NONSTDC_NAMES && !__STDC__)
        typedef _off_t off_t;
    #endif
#endif

This fixes:

F:\llvm-project\llvm\lib\DebugInfo\GSYM\FunctionInfo.cpp(118,16): warning: comparison of integers of different signs: 'const off_t' (aka 'const long') and 'unsigned int' [-Wsign-compare]
    if (Length > UINT32_MAX)
        ~~~~~~ ^ ~~~~~~~~~~
F:\llvm-project\llvm\lib\DebugInfo\GSYM\FunctionInfo.cpp(136,16): warning: comparison of integers of different signs: 'const off_t' (aka 'const long') and 'unsigned int' [-Wsign-compare]
    if (Length > UINT32_MAX)
        ~~~~~~ ^ ~~~~~~~~~~

Diff Detail