Sorting out the datatype mess

Martin Pitt martin at piware.de
Thu Sep 22 00:08:02 PDT 2005


Hi!

The current hal versions fail to build on at least the amd64
platform with gcc 4. configure fails with

  configure: error: BLKGETSIZE64 is not defined

but this is confusing since that symbol is perfectly fine. When
circumventing it, the build stops on a plethora of other spots.

The problem is the weird datatype handling. sys/types.h defines
[u]int64_t, but hal's config.h defines it *again* which is not allowed
by the C standard and gcc 4 chokes on it.

A few weeks ago I needed a quick hack to make it running properly
again, so with the help of sed I created a mega-patch [1] that
disables the type check in configure.in and replaces each and every
occurrence of the kernel-style datatypes (like _u8 and __s16) with
their appropriate standard datatype (uint8_t and int16_t).

There might be a less intrusive way to fix this, but in the end I
think that using the standard ISO C99 types is much better and more
robust. Please note that you should use <stdint.h> instead of
<sys/types.h> for maximum portability.

Any idea about this?

Thanks!

Martin

[1] http://people.ubuntu.com/~pitti/patches/hal-datatypes.patch

-- 
Martin Pitt              http://www.piware.de
Ubuntu Developer   http://www.ubuntulinux.org
Debian Developer        http://www.debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/hal/attachments/20050922/be59afbf/attachment.pgp


More information about the hal mailing list