[PATCH 2] Fix build on HP-UX 11.11

Andrew Borodin aborodin at vmail.ru
Wed Dec 12 06:23:37 UTC 2012


On Wed, 12 Dec 2012 00:30:36 +0100 (CET) Mikulas Patocka wrote:
> Unfortunatelly, I found out that my previous patch was wrong - it compiles 
> on HP-UX, but it doesn't use the 64-bit strtoimax instruction.
> 
> There were these problems:
> * strtoimax is defined in inttypes.h, not stdlib.h, so we must include 
> inttypes.h
> 
> * strtoimax is a macro that expands to __strtoll function. __strtoll only 
> exists in 32-bit libc. When building in 64-bit mode, strtoimax still 
> expands to __strtoll, but __strtoll doesn't exist (I think this is a bug 
> in HP-UX). So we must test for __strtoll in configure and use strtoimax 
> macro only if __strtoll is present in the libc. On 64-bit build we can use 
> strtol instead of strtoll, because strtol is already 64-bit.

We already decided to use g_ascii_strtoll [1] (see
https://www.midnight-commander.org/changeset/a2dd0f997cd98dc2ec70b90c9ddc43db8ad139cb).

> * on HP-UX inttypes.h includes ctype.h through other dependencies, ctype.h 
> defines macros for various functions and these macros clash with entries 
> of "struct str_class" - so we must undefine the macros before defining 
> str_class.

I'm not sure that we need global #undef of isspace, isdigit, etc. The better
way is rename str_class members to some unique names, probably use the "str_"
prefix.

-- 
Andrew



More information about the mc-devel mailing list