> You could also argue that the do_something definition is buggy,
> since it's not one statement.
Correct. But if you use brackets the code do what you want and
you get the result what you expect. Lint complains about
both.
> E.g. the Linux kernel takes this stance, and wraps such macros in do
> { } while (0) blocks:
> #define local_irq_enable() \ do { trace_hardirqs_on();
> raw_local_irq_enable(); } while (0) #define local_irq_disable() \ do
> { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
One possible way, but a bit tricky.
In most code you have the time to use inline functions (C99)
instead of makros. We use them a lot and try too avoid
any preprocessor macros at all.
Best Regards,
Carsten
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development