[New-bugs-announce] [issue6558] #ifdef linux is incorrect; should be #ifdef __linux__ (preferred standard)
Garrett Cooper
report at bugs.python.org
Fri Jul 24 03:17:54 CEST 2009
New submission from Garrett Cooper <yanegomi at gmail.com>:
The following files are looking for the `linux' constant, when it fact
they should be looking for `__linux__' (from 2.6.2 release's sources):
Modules/_ctypes/libffi/src/mips/ffitarget.h:#ifdef linux
Modules/socketmodule.c:#ifdef linux
Modules/socketmodule.c:#ifdef linux
The correct check is being made for FreeBSD (__FreeBSD__), for instance.
This is a defacto standard set by gcc, as discussed here:
<http://lists.debian.org/debian-devel/2001/01/msg00951.html>. You can
dump out all of the available constants for any given gcc compiler via:
[garrcoop at sjc-lds-102 ~/Python-2.6.2]$ echo "" | gcc -E -dM -c - | grep
linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1
I point this out because one of our compilers, doesn't have this
definition and it's tossing up errors with the linuxaudiodev and oss
modules periodically when cross-compiling, as shown below :(:
/nobackup/shujagan/tmp/contrib/python/Modules/linuxaudiodev.c:31: error:
conflicting types for 'uint32_t'
/nobackup/shujagan/tmp/linkfarm/mips32/usr/include/stdint.h:52: error:
previous declaration of 'uint32_t' was here
/nobackup/shujagan/tmp/contrib/python/Modules/ossaudiodev.c:37: error:
conflicting types for 'uint32_t'
/nobackup/shujagan/tmp/linkfarm/mips32/usr/include/stdint.h:52: error:
previous declaration of 'uint32_t' was here
We've suggested using --without-audio, but this is a standard which
should be adhered to as __linux__ is the constant of choice when looking
for the Linux compiler...
Thanks!
-Garrett
----------
assignee: theller
components: Build, Extension Modules, ctypes
messages: 90868
nosy: theller, yaneurabeya
severity: normal
status: open
title: #ifdef linux is incorrect; should be #ifdef __linux__ (preferred standard)
type: compile error
versions: Python 2.4, Python 2.5, Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6558>
_______________________________________
More information about the New-bugs-announce
mailing list