xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Annoying warning message


From: Jens Thoms Toerring
Subject: Re: [XForms] Annoying warning message
Date: Thu, 4 Oct 2012 16:30:21 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

   sorry for the delay, I'm just back from some holidays...

On Thu, Sep 27, 2012 at 08:29:24PM -0600, Luis Ernesto Carrera Retana wrote:
> I'm programming in a mac, with:
> 
> $ gcc --version
> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
> 
> The options in the compiling are:
> gcc -Wall -Wextra -std=c99 -pedantic -lforms -I/opt/local/include
> -L/opt/local/lib -c foo.c
> 
> and shows the following warning:
> In file included from /opt/local/include/X11/Xlib.h:47,
>                  from /opt/local/include/forms.h:99,
>                  from foo.c:2:
> /opt/local/include/X11/Xfuncproto.h:136:24: warning: ISO C does not permit
> named variadic macros
> 
> When I read the file Xfuncproto.h:
> 
> Xfuncproto.h :: 132
> /* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
>    argument macros, must be only used inside #ifdef _X_NONNULL guards, as
>    many legacy X clients are compiled in C89 mode still. */
> #if defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
> #define _X_NONNULL(args...)  __attribute__((nonnull(args)))
>                            <---------- line 136
> #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99
> */
> #define _X_NONNULL(...)  /* */
> #endif
> 
> So it seems to me that although i'm using c99, it reads as true line 135.
> Maybe is a mac problem. Anyway, I solved defining in the opposite way:
> 
> #if defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
> #define _X_NONNULL(...)  /* */
> #elif defined(__GNUC__) &&  ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
> #define _X_NONNULL(args...)  __attribute__((nonnull(args)))
> #endif

I think XForms is only an "innocent bystander" in this case: the
macro is defined in a header file that belongs to the Xlib which
XForms, of course, must include. So the only people that can apply
your (or a similar patch) are the X11 maintaners. The macro seems
to have been added sometime in the last two years and may not have
been tested well enough...

As far as I can see for the case of use of C99 one could further
change it to do

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
#define _X_NONNULL(...)  __attribute__((nonnull(__VA_ARGS__)))

to have the checks for non-NULL arguments (that's what the macro
seems to be about) also with C99 but I'm not sure if I see all
possible consequences.

On the other hand there also might be some extra problems with
your platform since I don't get this warnings on my Linux machine
(at least for a simple test program that just inclues 'forms.h')
even though the macros is also defined there.

If you write to the X11 maintainers it might be advantageous to
send them a simple example program that doesn't include 'forms.h'
but instead 'X11/Xlib.h' directly to avoid having them assume
that it's a problem with XForms. Of course, should you notice
that in that case the warning vanishes than I would agree that
it got too have something to do with XForms, though I have no
idea at the moment what that might be...

                             Best regards, Jens
-- 
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de



reply via email to

[Prev in Thread] Current Thread [Next in Thread]