All of lore.kernel.org
 help / color / mirror / Atom feed
From: g.strobbe@telenet.be
To: xenomai@xenomai.org
Subject: Re: [Xenomai] panic macro interference with xerces api.
Date: Wed, 11 Nov 2015 10:22:28 +0100 (CET)	[thread overview]
Message-ID: <752993598.201105477.1447233748728.JavaMail.root@telenet.be> (raw)
In-Reply-To: <20151110142814.GA4629@hermes.click-hack.org>


----- Original Message -----
> From: "Gilles Chanteperdrix" <gilles.chanteperdrix@xenomai.org>
> To: "Stéphane ANCELOT" <sancelot@free.fr>
> Cc: xenomai@xenomai.org
> Sent: Tuesday, November 10, 2015 3:28:14 PM
> Subject: Re: [Xenomai] panic macro interference with xerces api.
> 
> On Tue, Nov 10, 2015 at 02:26:54PM +0100, Stéphane ANCELOT wrote:
> > Hi,
> > 
> > I don't know if there might be a  big impact, but I noticed, depending
> > on the order we include headers , that
> > there was a panic macro interfering with xercesc api headers.
> > 
> > #include <alchemy/task.h>
> > #include <xercesc/dom/DOMException.hpp>
> > 
> > 
> > /usr/xenomai-3.0-igb/include/boilerplate/ancillaries.h:64:10: error:
> > expected identifier before '__func__'
> >    __panic(__func__, __fmt, ##__args)
> 
> Well, if the two headers define the same macro, there are not many
> solutions: arrange for not having to include them in the same file.
> It should not be too hard, since a real-time thread using
> alchemy/task.h has no business using an xml library, probably only
> using linux services which a real-time task can not use without
> switching to secondary mode.
> 
> --
> 					    Gilles.
> https://click-hack.org
> 
> _______________________________________________
> Xenomai mailing list
> Xenomai@xenomai.org
> http://xenomai.org/mailman/listinfo/xenomai
> 

I recently had a similar issue with the macro

#define panic(__fmt, __args...)			\
	__panic(__func__, __fmt, ##__args)

defined in ancillaries.h

The preprocessor modified virtual void panic(const PanicHandler::PanicReasons reason) = 0;

in the included xercesc/util/PanicHandler.hpp

resulting in a compilation error.

>From the gcc preprocessor manual https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html#Undefining-and-Redefining-Macros

If a macro ceases to be useful, it may be undefined with the ‘#undef’ directive. ‘#undef’ takes a single argument, the name of the macro to undefine. You use the bare macro name, even if the macro is function-like. It is an error if anything appears on the line after the macro name. ‘#undef’ has no effect if the name is not a macro.  

So after the #include <alchemy/task.h> I placed
            
#undef panic

No problems since. Should also be fine as a solution, no?

Best regards,

Gino





  reply	other threads:[~2015-11-11  9:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 13:26 [Xenomai] panic macro interference with xerces api Stéphane ANCELOT
2015-11-10 14:28 ` Gilles Chanteperdrix
2015-11-11  9:22   ` g.strobbe [this message]
2015-11-11 10:31   ` Jan Kiszka
2015-11-11 11:52     ` Philippe Gerum
2015-11-11 12:28       ` Philippe Gerum
2015-11-11 12:35         ` Philippe Gerum
2015-11-12  7:37           ` Stéphane ANCELOT
2015-11-12  9:47             ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=752993598.201105477.1447233748728.JavaMail.root@telenet.be \
    --to=g.strobbe@telenet.be \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.