chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] Simplify and correct C_SIXTY_FOUR check (fix #


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Simplify and correct C_SIXTY_FOUR check (fix #979)
Date: Sat, 17 Aug 2013 21:36:45 +0200
User-agent: Mutt/1.4.2.3i

Hi all,

As has been pointed out in #979, our "detection" logic aronud the setting
of the C_SIXTY_FOUR macro (which indicates we're running on a 64-bit
machine) is a little iffy; it mixes up features, architectures and
operating systems and tries to say "yep, this is a 64-bit machine"
from that.  This check is broken at least for Windows, because it
checks for __MINGW64__, but of course that's not defined by MSVC or
Watcom C.

Here's a patch that simplifies this check.  While looking for the
correct way to do this, I've found a resource which may not be 100%
complete but is still useful: http://predef.sf.net - a list of
predefined compiler macros for a lot of platforms and systems.

According to its page about data models, __LP64__ is defined by
GCC and _LP64 is defined by HP aCC and SunW.
https://sourceforge.net/p/predef/wiki/DataModels/
Windows doesn't do this, but there we should have _WIN64 (which is LLP64):
https://sourceforge.net/p/predef/wiki/OperatingSystems/#windows

I've tested this change on NetBSD/amd64 with GCC and LLVM/Clang,
and on Linux/i386 with GCC.  I'd appreciate it if people on other
platforms/compilers (especially Windows and OS X) could test this.

According to https://sourceforge.net/p/predef/wiki/Endianness/
we should probably also revise our ENDIAN checks, but I don't quite
dare to attack that one yet.  Let's see how bad the fallout from
this change is, first.

Cheers,
Peter
-- 
http://www.more-magic.net

Attachment: 0001-Clean-up-64-bit-detection-logic-for-C_SIXTY_FOUR-and.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]