Eric Blake <[email protected]> writes: > On Fri, Apr 04, 2025 at 02:16:03PM +0200, Simon Josefsson wrote: >> Eric Blake <[email protected]> writes: >> >> >> # define G_GNUC_IDN2_ATTRIBUTE_PURE __attribute__ ((pure)) >> ... >> >> extern _IDN2_API const char *idn2_check_version (const char >> >> *req_version) >> >> G_GNUC_IDN2_ATTRIBUTE_PURE; >> > >> > Figuring out how to write the __attribute__-hiding macros conditional >> > on compiler version wasn't the issue (the m4 definitions for >> > ATTRIBUTE_PURE come from gnulib, and are under a similar ladder of >> > #if); rather, it's that an all-caps macro that takes no arguments and >> > appears after the func(params) but before the trailing ; of an extern >> > function declaration confuse indent. >> >> By formatting things like the above, without any '(())', then indent is >> happy. I run indent on the idn2.h and it looks like the above without >> any INDENT-OFF. If I included the '(())' part, then just like you I had >> issues getting indent to behave. The conditional part is unrelated to >> the indent issue, but I can see that my recommendation was unclear. > > ATTRIBUTE_COLD wasn't necessarily the problem. It was > "ATTRIBUTE_FORMAT ((__printf__, 3, 4))". And that one needs > parameters, since it applies to a varargs that is not at a fixed > location.
Would then the following not work? The point is to move the (()) out
from the function declaration.
#define M4_ATTRIBUTE_FORMAT_PRINTF34 __attribute__ ((__format__ (__printf__, 3,
4)))
extern void
m4_error (int, int, const char *, ...)
M4_ATTRIBUTE_FORMAT_PRINTF34;
/Simon
signature.asc
Description: PGP signature
