[PATCH] D69631: Fix a gsym warning on Windows
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 11:12:08 PDT 2019
aganea created this revision.
aganea added a reviewer: clayborg.
aganea added a project: LLVM.
Herald added subscribers: llvm-commits, hiraditya.
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)
~~~~~~ ^ ~~~~~~~~~~
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69631
Files:
llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
Index: llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
===================================================================
--- llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
+++ llvm/lib/DebugInfo/GSYM/FunctionInfo.cpp
@@ -114,7 +114,7 @@
llvm::Error err = OptLineTable->encode(O, Range.Start);
if (err)
return std::move(err);
- const off_t Length = O.tell() - StartOffset;
+ const uint64_t Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
"LineTable length is greater than UINT32_MAX");
@@ -132,7 +132,7 @@
llvm::Error err = Inline->encode(O, Range.Start);
if (err)
return std::move(err);
- const off_t Length = O.tell() - StartOffset;
+ const uint64_t Length = O.tell() - StartOffset;
if (Length > UINT32_MAX)
return createStringError(std::errc::invalid_argument,
"InlineInfo length is greater than UINT32_MAX");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69631.227144.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191030/e69dd4ee/attachment.bin>
More information about the llvm-commits
mailing list