On Tue, 9 Feb 2010, Garrett Wollman wrote:

<<On Tue, 9 Feb 2010 23:50:25 -0500, Tom Keiser <[email protected]> said:

#ifdef AFS_AIX_ENV
#define osi_Panic(buf, ...) \
    do { \
        printf(buf, __VA_ARGS__); \
        panic(buf); \
    } while (0)
#endif

If you're willing to use fancy C99 macro stuff, then why not:

#ifdef AFS_PANIC_DOES_THE_RIGHT_THING
#define osi_Panic panic
#else
#define osi_Panic(...) \
        do { \
                printf(__VA_ARGS__); \
                osi_DoPanic(__VA_ARGS__); \

Since AIX (and I think IRIX as well) kernel crash dumps include the panic string, I'd probably tweak this slightly:


extern char * osi_panic_msg;

#ifdef AFS_PANIC_DOES_THE_RIGHT_THING
#define osi_Panic panic
#else
#define osi_Panic(...) \
    do { \
        printf(__VA_ARGS__); \
        sprintf(osi_panic_msg, __VA_ARGS__); \
        osi_DoPanic(osi_panic_msg); \
    } while (0)

void
osi_DoPanic(const char * msg)
{
    panic(msg);
}

Admittedly, it's racy, but more helpful in the common case.


        } while (0)

static void __inline

We'd probably just declare osi_DoPanic as extern to get around the whole inlining portability mess.


osi_DoPanic(const char *fmt, ...)
{
        panic(fmt);
}
#endif

Or does it still require an extra lead-in argument there?


I think you're right that eliminating the lead-in argument is the right way to do this (verified on xlC).

-Tom
_______________________________________________
OpenAFS-devel mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to