X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.9 required=5.0	tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_XC
X-Spam-Check-By: sourceware.org
Message-ID: <50F2C529.6070303@dronecode.org.uk>
Date: Sun, 13 Jan 2013 14:31:05 +0000
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Reply-To: cygwin@cygwin.com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
MIME-Version: 1.0
To: cygwin@cygwin.com
CC: angelo.graziosi@alice.it
Subject: Re: Another issue with CLANG
References: <50F00B98.9090306@alice.it>
In-Reply-To: <50F00B98.9090306@alice.it>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 11/01/2013 12:54, Angelo Graziosi wrote:
> An application which need to be built with clang++, fails to build when it
> includes glx.h and indirectly windows.h headers like in the test case shown
> below.
> 
> In short, X11/Xlib.h define Status as a macro (an alias for int) instead
> rpcdce.h uses Status a a pointer variable name...

I don't think there's anything clang-specific about this problem.  The same
issue can be seen with gcc.

If your application needs both Xlib and Win32 interfaces, you should include
<X11/Xwindows.h> rather than <windows.h>, which wraps any conflicting
declarations.

(xcb uses a sensible namespace, so this is not necessary for applications
which use xcb and Win32.)

You probably need the latest upstream x11proto (not yet packaged for cygwin)
for this wrapping to work correctly with the mingw-w64 w32api headers [1]

Alternatively you can work around this yourself e.g. as in [2]

> $ cat foo.cxx
> #include <GL/glx.h>
> #include <windows.h>
> 
> 
> int foo()
> {
>   return 0;
> }
> 
> $ clang++ -D_X86_=1 -c foo.cxx -o foo.o

[1]
http://cgit.freedesktop.org/xorg/proto/xproto/commit/?id=c0dd615fddb6fa487d1a914c6928f3843489725e
[2]
http://cgit.freedesktop.org/~jturney/xserver/commit/?h=cygwin-patches-for-1.13&id=c493cd82c5b512efad284304f19349cc84a2c63d

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

