All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] panic macro interference with xerces api.
@ 2015-11-10 13:26 Stéphane ANCELOT
  2015-11-10 14:28 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 9+ messages in thread
From: Stéphane ANCELOT @ 2015-11-10 13:26 UTC (permalink / raw)
  To: xenomai

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)
           ^
Regards,
Steph


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  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
  2015-11-11 10:31   ` Jan Kiszka
  0 siblings, 2 replies; 9+ messages in thread
From: Gilles Chanteperdrix @ 2015-11-10 14:28 UTC (permalink / raw)
  To: Stéphane ANCELOT; +Cc: xenomai

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-10 14:28 ` Gilles Chanteperdrix
@ 2015-11-11  9:22   ` g.strobbe
  2015-11-11 10:31   ` Jan Kiszka
  1 sibling, 0 replies; 9+ messages in thread
From: g.strobbe @ 2015-11-11  9:22 UTC (permalink / raw)
  To: xenomai


----- 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-10 14:28 ` Gilles Chanteperdrix
  2015-11-11  9:22   ` g.strobbe
@ 2015-11-11 10:31   ` Jan Kiszka
  2015-11-11 11:52     ` Philippe Gerum
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2015-11-11 10:31 UTC (permalink / raw)
  To: Gilles Chanteperdrix, Stéphane ANCELOT; +Cc: xenomai

On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
> 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.

Isn't *panic an internal service? Then we can maybe avoid that it is
exposed to applications. If it's not internal, it should probably carry
some "xenomai" prefix in its (fairly generic) name.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-11 10:31   ` Jan Kiszka
@ 2015-11-11 11:52     ` Philippe Gerum
  2015-11-11 12:28       ` Philippe Gerum
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2015-11-11 11:52 UTC (permalink / raw)
  To: Jan Kiszka, Gilles Chanteperdrix, Stéphane ANCELOT; +Cc: xenomai

On 11/11/2015 11:31 AM, Jan Kiszka wrote:
> On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
>> 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.
> 
> Isn't *panic an internal service? Then we can maybe avoid that it is
> exposed to applications. If it's not internal, it should probably carry
> some "xenomai" prefix in its (fairly generic) name.
> 

Sure, this service is aimed at being fairly generic and general-purpose,
with backtracing support, timing data, error code translation and such.
With respect to layering, I would rather expect an XML lib not to mess
with the namespace of core services, instead of asking the xenomai libs
which do deliver core services to apps to prefix its own services.

I may move those helpers in some specific file to hide them, but no, I
really don't want to go for xenomai_panic(), because it really should
work the other way around (although nobody is likely to care about this
on the apache side).

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-11 11:52     ` Philippe Gerum
@ 2015-11-11 12:28       ` Philippe Gerum
  2015-11-11 12:35         ` Philippe Gerum
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2015-11-11 12:28 UTC (permalink / raw)
  To: Jan Kiszka, Gilles Chanteperdrix, Stéphane ANCELOT; +Cc: xenomai

On 11/11/2015 12:52 PM, Philippe Gerum wrote:
> On 11/11/2015 11:31 AM, Jan Kiszka wrote:
>> On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
>>> 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.
>>
>> Isn't *panic an internal service? Then we can maybe avoid that it is
>> exposed to applications. If it's not internal, it should probably carry
>> some "xenomai" prefix in its (fairly generic) name.
>>
> 
> Sure, this service is aimed at being fairly generic and general-purpose,
> with backtracing support, timing data, error code translation and such.
> With respect to layering, I would rather expect an XML lib not to mess
> with the namespace of core services, instead of asking the xenomai libs
> which do deliver core services to apps to prefix its own services.
> 
> I may move those helpers in some specific file to hide them, but no, I
> really don't want to go for xenomai_panic(), because it really should
> work the other way around (although nobody is likely to care about this
> on the apache side).
> 

Actually, the only issue is about defining the panic helpers as macros,
so that we can pull the source/line information automatically. The
namespace issue should not affect C++.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-11 12:28       ` Philippe Gerum
@ 2015-11-11 12:35         ` Philippe Gerum
  2015-11-12  7:37           ` Stéphane ANCELOT
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Gerum @ 2015-11-11 12:35 UTC (permalink / raw)
  To: Jan Kiszka, Gilles Chanteperdrix, Stéphane ANCELOT; +Cc: xenomai

On 11/11/2015 01:28 PM, Philippe Gerum wrote:
> On 11/11/2015 12:52 PM, Philippe Gerum wrote:
>> On 11/11/2015 11:31 AM, Jan Kiszka wrote:
>>> On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
>>>> 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.
>>>
>>> Isn't *panic an internal service? Then we can maybe avoid that it is
>>> exposed to applications. If it's not internal, it should probably carry
>>> some "xenomai" prefix in its (fairly generic) name.
>>>
>>
>> Sure, this service is aimed at being fairly generic and general-purpose,
>> with backtracing support, timing data, error code translation and such.
>> With respect to layering, I would rather expect an XML lib not to mess
>> with the namespace of core services, instead of asking the xenomai libs
>> which do deliver core services to apps to prefix its own services.
>>
>> I may move those helpers in some specific file to hide them, but no, I
>> really don't want to go for xenomai_panic(), because it really should
>> work the other way around (although nobody is likely to care about this
>> on the apache side).
>>
> 
> Actually, the only issue is about defining the panic helpers as macros,
> so that we can pull the source/line information automatically.
> 

We are not even doing that anymore, so this is eventually about moving
these helpers in some header that would not be pulled indirectly, or
using a different internal identifier from the reserved namespace.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-11 12:35         ` Philippe Gerum
@ 2015-11-12  7:37           ` Stéphane ANCELOT
  2015-11-12  9:47             ` Philippe Gerum
  0 siblings, 1 reply; 9+ messages in thread
From: Stéphane ANCELOT @ 2015-11-12  7:37 UTC (permalink / raw)
  To: Philippe Gerum, Jan Kiszka, Gilles Chanteperdrix; +Cc: xenomai

On 11/11/2015 13:35, Philippe Gerum wrote:
> On 11/11/2015 01:28 PM, Philippe Gerum wrote:
>> On 11/11/2015 12:52 PM, Philippe Gerum wrote:
>>> On 11/11/2015 11:31 AM, Jan Kiszka wrote:
>>>> On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
>>>>> 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.
>>>> Isn't *panic an internal service? Then we can maybe avoid that it is
>>>> exposed to applications. If it's not internal, it should probably carry
>>>> some "xenomai" prefix in its (fairly generic) name.
>>>>
>>> Sure, this service is aimed at being fairly generic and general-purpose,
>>> with backtracing support, timing data, error code translation and such.
>>> With respect to layering, I would rather expect an XML lib not to mess
>>> with the namespace of core services, instead of asking the xenomai libs
>>> which do deliver core services to apps to prefix its own services.
>>>
>>> I may move those helpers in some specific file to hide them, but no, I
>>> really don't want to go for xenomai_panic(), because it really should
>>> work the other way around (although nobody is likely to care about this
>>> on the apache side).
>>>
>> Actually, the only issue is about defining the panic helpers as macros,
>> so that we can pull the source/line information automatically.
>>
> We are not even doing that anymore, so this is eventually about moving
> these helpers in some header that would not be pulled indirectly, or
> using a different internal identifier from the reserved namespace.
>
I ordered differently the headers to enable compilation.
I may arrange source code , since the xerces lib is needed only for data 
parsing  during the setup process.
Regards,
Steph



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Xenomai] panic macro interference with xerces api.
  2015-11-12  7:37           ` Stéphane ANCELOT
@ 2015-11-12  9:47             ` Philippe Gerum
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Gerum @ 2015-11-12  9:47 UTC (permalink / raw)
  To: Stéphane ANCELOT, Jan Kiszka, Gilles Chanteperdrix; +Cc: xenomai

On 11/12/2015 08:37 AM, Stéphane ANCELOT wrote:
> On 11/11/2015 13:35, Philippe Gerum wrote:
>> On 11/11/2015 01:28 PM, Philippe Gerum wrote:
>>> On 11/11/2015 12:52 PM, Philippe Gerum wrote:
>>>> On 11/11/2015 11:31 AM, Jan Kiszka wrote:
>>>>> On 2015-11-10 15:28, Gilles Chanteperdrix wrote:
>>>>>> 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.
>>>>> Isn't *panic an internal service? Then we can maybe avoid that it is
>>>>> exposed to applications. If it's not internal, it should probably
>>>>> carry
>>>>> some "xenomai" prefix in its (fairly generic) name.
>>>>>
>>>> Sure, this service is aimed at being fairly generic and
>>>> general-purpose,
>>>> with backtracing support, timing data, error code translation and such.
>>>> With respect to layering, I would rather expect an XML lib not to mess
>>>> with the namespace of core services, instead of asking the xenomai libs
>>>> which do deliver core services to apps to prefix its own services.
>>>>
>>>> I may move those helpers in some specific file to hide them, but no, I
>>>> really don't want to go for xenomai_panic(), because it really should
>>>> work the other way around (although nobody is likely to care about this
>>>> on the apache side).
>>>>
>>> Actually, the only issue is about defining the panic helpers as macros,
>>> so that we can pull the source/line information automatically.
>>>
>> We are not even doing that anymore, so this is eventually about moving
>> these helpers in some header that would not be pulled indirectly, or
>> using a different internal identifier from the reserved namespace.
>>
> I ordered differently the headers to enable compilation.
> I may arrange source code , since the xerces lib is needed only for data
> parsing  during the setup process.

This change from the stable branch should prevent the conflict from
arising. Including boilerplate/ancillaries.h is now required to pull the
related definitions (no more indirect inclusion from the API headers),
which should limit the scope of conflict to direct users of the
ancillaries services.

http://git.xenomai.org/xenomai-3.git/commit/?h=stable-3.0.x&id=5c88a11c11e9a2b13be4da91624dc3f3ff323e46

-- 
Philippe.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-12  9:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.