Re: [xproto] _X_NONNULL and C++ 11
On 05/27/17 02:02 AM, Matthieu Herrb wrote: 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 ? I could swear there was some use for it when it was added, but I can't find any either in the sources, nor in the introducing commit: https://cgit.freedesktop.org/xorg/proto/x11proto/commit/Xfuncproto.h.in?id=217d1dae0093ccaaac59a4fa42000e732492cb66 Jeremy - did you ever add usage of this somewhere we're not seeing, such as in the macosforge repos? -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - http://blogs.oracle.com/alanc ___ 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
Re: [xproto] _X_NONNULL and C++ 11
Am 27.05.2017 14:10, schrieb Mark Kettenis: >> Date: Sat, 27 May 2017 13:33:25 +0200 >> From: walter harms>> >> 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 >>> 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 ? > > GCC 4.9.4 warns as well: > > $ g++ -pedantic -std=c++11 -I/usr/X11R6/include xfunc.cc > In file included from xfunc.cc:1:0: > /usr/X11R6/include/X11/Xfuncproto.h:173:24: warning: ISO C does not permit > named variadic macros [-Wvariadic-macros] > #define _X_NONNULL(args...) __attribute__((nonnull(args))) > i have checked my version and can confirm the problem also with gcc (and -pedantic). i guess it is more simple the remove the macro completely. It is only for optimization, it is never used, ... lets remove it. 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
Re: [xproto] _X_NONNULL and C++ 11
> Date: Sat, 27 May 2017 13:33:25 +0200 > From: walter harms> > 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 > > 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 ? GCC 4.9.4 warns as well: $ g++ -pedantic -std=c++11 -I/usr/X11R6/include xfunc.cc In file included from xfunc.cc:1:0: /usr/X11R6/include/X11/Xfuncproto.h:173:24: warning: ISO C does not permit named variadic macros [-Wvariadic-macros] #define _X_NONNULL(args...) __attribute__((nonnull(args))) ___ 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
Re: [xproto] _X_NONNULL and C++ 11
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> 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
[xproto] _X_NONNULL and C++ 11
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 EspieDate: 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) -- 2.13.0 -- Matthieu Herrb signature.asc Description: PGP signature ___ 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