On Wed, Aug 27, 2008 at 3:22 PM, Stefan Johnson <[EMAIL PROTECTED]> wrote:
> I've been working with the InspIRCd group to try to get it working on
> OpenBSD again.  The server I'm doing this on is OpenBSD 4.2 on an
> Alphaserver 1000 4/200.
>
> There is a header which has the following section:
>
> #ifdef __GNUC__
> #define CUSTOM_PRINTF(STRING, FIRST) __attribute__((format(printf, STRING,
> FIRST)))
> #else
> #define CUSTOM_PRINTF(STRING, FIRST)
> #endif
>
> There is a .cpp file which includes that header and contains the following
> function definition:
>
>        void WriteCommonFrom(User *user, Channel* channel, const char* text,
> ...) CUSTOM_PRINTF(4,5)
>        {
...
> m_delayjoin.cpp:197: error: syntax error before `{' token
...
> Line 197 is the line that calls CUSTOM_PRINTF.  If the CUSTOM_PRINTF portion
> is removed, the module compiles.
> Is there a different format expected for __attribute__ that should be looked
> at?

gcc only started permitting function attributes on function
definitions (as opposed to function declarations) in very recent
versions, newer than the versions included with OpenBSD.  To be
portable to earlier versions, move the CUSTOM_PRINTF macro usage to
the function declaration  If it's already there, then simply delete
the one on the definition.  If the function doesn't have a
declaration, then add one, etc.


Philip Guenther

Reply via email to