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

Bug#174933: libc header defines LITTLE_ENDIAN and polluts user name space



Package: libc6-dev
Version: 2.2.5-14.3

Severity: normal

Problem description.

libc header somehow pollutes the
user name space by defining a macro, LITTLE_ENDIAN.
This doesn't happen, say, on RedHat linux and
so presumably a problem of configuring glibc under
Debian.

REPEAT-BY:

Please note the following little program that
includes "<stdlib.h>".
I take that stdlib.h is part of ISO C99 standard (draft?)
from the comment near the top
 Quote :
/*
 *	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 */
 Unquote


If I compile this program by defining LITTLE_ENDIAN with
-DLITTLE_ENDIAN=1 on the command line, I get warning
from GCC. This doesn't happen on other UNIX-like systems, say,
RedHat and Solaris.

ishikawa@duron$ cat little.c
#include <stdlib.h>
#include <string.h>

int
test(int i)
{
	return i + 10;
}

ishikawa@duron$ gcc -v -DLITTLE_ENDIAN=1 -c little.c
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
 /usr/lib/gcc-lib/i386-linux/2.95.4/cpp0 -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -DLITTLE_ENDIAN=1 little.c /tmp/ccpuhTGN.i
GNU CPP version 2.95.4 20011002 (Debian prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/2.95.4/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../i386-linux/include
End of omitted list.
In file included from /usr/include/sys/types.h:212,
                 from /usr/include/stdlib.h:390,
                 from little.c:1:
/usr/include/endian.h:46: warning: `LITTLE_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous definition
 /usr/lib/gcc-lib/i386-linux/2.95.4/cc1 /tmp/ccpuhTGN.i -quiet -dumpbase little.c -version -o /tmp/cckeNbGt.s
GNU C version 2.95.4 20011002 (Debian prerelease) (i386-linux) compiled by GNU C version 2.95.4 20011002 (Debian prerelease).
 as -V -Qy -o little.o /tmp/cckeNbGt.s
GNU assembler version 2.13.90.0.10 (i386-linux) using BFD version 2.13.90.0.10 20021010 Debian GNU/Linux
ishikawa@duron$ 


ishikawa@duron$ grep LITTLE_ENDIAN /usr/include/endian.h
#define	__LITTLE_ENDIAN	1234
# define LITTLE_ENDIAN	__LITTLE_ENDIAN
#if __BYTE_ORDER == __LITTLE_ENDIAN
ishikawa@duron$ 




Package Status

ishikawa@duron$ dpkg --status libc6-dev
Package: libc6-dev
Status: install ok installed
Priority: standard
Section: devel
Installed-Size: 11620
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Source: glibc
Version: 2.2.5-14.3
Replaces: man-db (<= 2.3.10-41), gettext (<= 0.10.26-1), ppp (<= 2.2.0f-24), libgdbmg1-dev (<= 1.7.3-24), ldso (<= 1.9.11-9), netkit-rpc, netbase (<< 4.0)
Provides: libc-dev
Depends: libc6 (= 2.2.5-14.3)
Recommends: c-compiler
Suggests: glibc-doc
Conflicts: libstdc++2.10-dev (<< 1:2.95.2-15), gcc-2.95 (<< 1:2.95.3-9), libpthread0-dev, libdl1-dev, libdb1-dev, libgdbm1-dev, libc6-dev (<< 2.0.110-1), locales (<< 2.1.3-5), libstdc++2.9-dev, netkit-rpc, libc-dev
Description: GNU C Library: Development Libraries and Header Files.
 Contains the symlinks, headers, and object files needed to compile
 and link programs which use the standard C library.




Reply to: