Incorrect conditional testing in servermd.h related to linux/arm

Gaetan Nadon memsize at videotron.ca
Fri Feb 21 06:50:44 PST 2014


On 14-02-20 10:33 AM, Arnaud Fontaine wrote:
> while compiling mesa on Linux/ARM (and for Linux/ARM), I had a problem
> with the servermd.h file coming from xorg-server.
>
> I found incorrect conditional tests on "linux" variable while it should
> be on "__linux__" variable. This mistake occurs at several places in the
> servermd.h file. The attached patch is actually fixing this issue.
Grepping the server shows both "__linux__" and "linux" are used, twice
as many of the former.

On my Ubuntu system:

    gcc -dM -E - < /dev/null | grep linux

    #define __linux 1
    #define __linux__ 1
    #define __gnu_linux__ 1
    #define linux 1

On a site which I referred to for OS identifying macros:

    Linux kernel

    Systems based on the Linux kernel define these macros. There are two
    major Linux-based operating systems:
    GNU/Linux and Android, and numerous others like Ångström or OpenEmbedded

    Type     Macro     Description
    Identification     __linux__     1
    Identification     linux         Obsolete (not POSIX compliant)
    Identification     __linux       Obsolete (not POSIX compliant)


Here is a bug report because __linux__ is not defined:

    https://bugs.launchpad.net/linaro-android/+bug/868550

A bug report because "linux" is being checked rather than "__linux__"

    http://bugs.python.org/issue6558

Someone must have the authoritative answer by now, as I have seen this
question being asked in 1998. Still cannot easily find an answer.

Given that both are used on the server, there would be no arm is using
__linux__. It already works every where. Could you amend the commit text
to name the compiler you use, and if gcc, provide the list of defines
for linux.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140221/51affccf/attachment.html>


More information about the xorg-devel mailing list