[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: cpp and _Pragma()
From:       Anders Magnusson <ragge () ludd ! ltu ! se>
Date:       2008-08-16 15:32:43
Message-ID: 48A6F31B.9090504 () ludd ! ltu ! se
[Download RAW message or body]

Gregory McGarry wrote:
> It seems cpp is expanding _Pragma() to the output too early and it's
> possible for #pragma lines to appear in the wrong place.  This is a
> particular problem with macros containing multiple macros with _Pragma()s.
> 
> In this example you can see that function x appears in the wrong linkset.
> 
> #ifdef __PCC__
> #define __section(x)    _Pragma("section " #x)
> #else
> #define __section(x)    __attribute__((__section__( #x )))
> #endif
> 
> #define __def(x,y) static void const __link_set_ ## y __section(x) = &y
> 
> void x() { }
> void y() { }
> 
> #define __def1(x,y)     __def(.link_set1, x); __def(.linkset2, y);
> 
> __def1(x,y)
> 
> 
> This particular problem is stopping the NetBSD kernel booting, because
> junk is appearing in the linksets.
> 
> I looked at pragoper() intending to unput() the #pragma line, but it
> didn't quite work as I had hoped.
> 
> 
cpp printed did the conversion _Pragma -> #pragma too early.  Fixed now, thanks.

-- Ragge
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic