Am 27.05.2017 11:02, schrieb Matthieu Herrb: > Hi, > > Marc Espie recently found out that the X_NONNULL macro in Xfuncproto.h > is generating spurious warnings when included in C++ code build with > clang++ -std=c++11. > > Other OpenBSD developper tried to find uses of the macro in the wild > and didn't find any, even in the X.Org lib app or xserver tree. > > So, should this macro definition be removed alltogether (acking that > no-one cares to use it) or just apply the patch below ? > > From 6ae956660879d70e078025c3d8f1ac3fd438cad2 Mon Sep 17 00:00:00 2001 > From: Marc Espie <es...@nerim.net> > Date: Sat, 27 May 2017 10:55:04 +0200 > Subject: [PATCH] Fix compiling any C++ code including Xfuncproto.h with > clang++ -std=c++11 > > It shouldn't warn, bu it will use the "legacy" varargs macros and whine. > --- > Xfuncproto.h.in | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in > index b88493d..1be3f55 100644 > --- a/Xfuncproto.h.in > +++ b/Xfuncproto.h.in > @@ -166,7 +166,8 @@ in this Software without prior written authorization from > The Open Group. > argument macros, must be only used inside #ifdef _X_NONNULL guards, as > many legacy X clients are compiled in C89 mode still. */ > #if __has_attribute(nonnull) \ > - && defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 > */ > + && (defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) \ > + || (defined(__cplusplus) && (__cplusplus - 0 >= 201103L))) /* C99 C++11 > */ > #define _X_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) > #elif __has_attribute(nonnull) \ > || defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303) > > >
So far i understand this is a problem with clang++. "spurious warning" sounds for me more like a compiler bug (assuming that gcc has no problems with that). So why not make that a NOOP until fixed in clang ? re, wh _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel