LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 804 - Warnings during building under Win32
Summary: Warnings during building under Win32
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: System Library (show other bugs)
Version: trunk
Hardware: PC Windows 2000
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: code-cleanup
Depends on:
Blocks:
 
Reported: 2006-06-08 05:01 PDT by Anton Korobeynikov
Modified: 2010-02-22 12:53 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Korobeynikov 2006-06-08 05:01:14 PDT
I'm constantly get the folowing warnings during build:

In file included from f:/tmp/llvm/build/../src/lib/System/Path.cpp:107:
f:/tmp/llvm/build/../src/lib/System/Win32/Path.inc: In static member function
`static llvm::sys::Path llvm::sys::Path::GetTemporaryDirectory()':
f:/tmp/llvm/build/../src/lib/System/Win32/Path.inc:124: warning: unsigned int
format, DWORD arg (arg 3)
f:/tmp/llvm/build/../src/lib/System/Win32/Path.inc: In member function `void
llvm::sys::Path::getStatusInfo(llvm::sys::Path::StatusInfo&) const':
f:/tmp/llvm/build/../src/lib/System/Win32/Path.inc:343: warning: left shift
count >= width of type

Today I've decided to look inside.

The first warning fixes easily just by casting DWORD to unsigned.
The second is much more hm...

Win32/Path.inc:343:
  info.fileSize = fi.nFileSizeHigh;
  info.fileSize <<= 32;
  info.fileSize += fi.nFileSizeLow;

info is StatusInfo, so fileSize is size_t, which is 32 bits here.

The main question: should this get fixed somehow or not?
Comment 2 Anton Korobeynikov 2006-06-08 13:02:28 PDT
Yes. That fixed the warning.

One more additional patch (GetCurrentProcessId() is DWORD, which is signed):

--- lib/System/Win32/Path.inc	46db45fba9a284264f13eb41377ba92c8a6210ca
+++ lib/System/Win32/Path.inc	ab3912c28f2fce713574f5f4c6248ac808bde8dc
@@ -121,7 +121,7 @@
 
   // Append a subdirectory passed on our process id so multiple LLVMs don't
   // step on each other's toes.
-  sprintf(pathname, "LLVM_%u", GetCurrentProcessId());
+  sprintf(pathname, "LLVM_%u", (unsigned)GetCurrentProcessId());
   result.appendComponent(pathname);
 
   // If there's a directory left over from a previous LLVM execution that
Comment 3 Reid Spencer 2006-06-08 13:09:43 PDT
Committed here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20060605/035469.html

Resolving this as fixed. Please re-open if there are more issues.