cygwin build problems

Cygwin's <stdint.h> defines uint32_t as "unsigned long". I think this
is valid, but it causes various problems like this when building LLVM
with GCC 3.4.4:

.../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3440: error: call of
overloaded `AddInteger(uint32_t)' is ambiguous

.../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1429: error: no matching
function for call to `max(long unsigned int, unsigned int&)'

.../include/llvm/ADT/DenseMap.h: In member function `void
llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT,

::AdvancePastEmptyBuckets() [with KeyT = uint32_t, ValueT =

llvm::Value*, KeyInfoT = llvm::DenseMapInfo<uint32_t>, ValueInfoT =
llvm::DenseMapInfo<llvm::Value*>]':
.../include/llvm/ADT/DenseMap.h:479: instantiated from
`llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, ValueInfoT>&
llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT,

::operator++() [with KeyT = uint32_t, ValueT =

llvm::Value*, KeyInfoT = llvm::DenseMapInfo<uint32_t>, ValueInfoT =
llvm::DenseMapInfo<llvm::Value*>]'
.../lib/Transforms/Scalar/GVN.cpp:757: instantiated from here
.../include/llvm/ADT/DenseMap.h:488: error: `getEmptyKey' is not a
member of `llvm::DenseMapInfo<uint32_t>'
.../include/llvm/ADT/DenseMap.h:489: error: `getTombstoneKey' is not a
member of `llvm::DenseMapInfo<uint32_t>'
.../include/llvm/ADT/DenseMap.h:491: error: `isEqual' is not a member
of `llvm::DenseMapInfo<uint32_t>'
.../include/llvm/ADT/DenseMap.h:491: error: `isEqual' is not a member
of `llvm::DenseMapInfo<uint32_t>'

I've attached a patch to fix these. This allows me to build LLVM on cygwin.

If there's consensus as to whether to use "uint32_t" or "unsigned"
then I could try to fix this more cleanly by using that type
throughout, rather than just adding casts where it causes a problem.

Is this appropriate? If so, can you apply it please?

Thanks,
Jay.

unsigned.patch (8.89 KB)

I've attached a patch to fix these. This allows me to build LLVM on cygwin.

Sorry, I didn't mean to include this hunk:

Index: CMakeLists.txt

"Jay Foad" <jay.foad@gmail.com> writes:

Sorry, I didn't mean to include this hunk:

Index: CMakeLists.txt

--- CMakeLists.txt (revision 58429)
+++ CMakeLists.txt (working copy)
@@ -31,8 +31,13 @@
   )

if(WIN32)
- set(LLVM_ON_WIN32 1)
- set(LLVM_ON_UNIX 0)
+ if(CYGWIN)
+ set(LLVM_ON_WIN32 0)
+ set(LLVM_ON_UNIX 1)
+ else(CYGWIN)
+ set(LLVM_ON_WIN32 1)
+ set(LLVM_ON_UNIX 0)
+ endif(CYGWIN)
   set(LTDL_SHLIB_EXT ".dll")
   set(EXEEXT ".exe")
   # Maximum path length is 160 for non-unicode paths

But I do need it, or something like it, in order to build with CMake
on cygwin.

It is okay to apply this change.

"Jay Foad" <jay.foad@gmail.com> writes:

Sorry, I didn't mean to include this hunk:

[snipped Cygwin-specific variable settings on CMakeLists.txt]

But I do need it, or something like it, in order to build with CMake
on cygwin.

Just in case your patch does not pass through, I applied this hunk.

Thanks!

Was fixed in later versions of cygwin as well:
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/include/stdint.h.diff?r1=1.10&r2=1.7.4.1&cvsroot=src&f=h

I also need the attached patch when building with GCC 4.3.2 on cywing,
to avoid lots of warnings like this:

.../lib/Transforms/Utils/BasicInliner.cpp:55: warning: visibility
attribute not supported in this configuration; ignored

Jay.

visibility.patch (568 Bytes)

Hello, Jay

I also need the attached patch when building with GCC 4.3.2 on cywing,
to avoid lots of warnings like this:

Applied, thanks!