Re: bug formatting a .h function extern declaration with attribute macros

Simon Josefsson via Bug reports for the GNU m4 macro processor <[email protected]> Fri, 04 Apr 2025 14:16:03 +0200
Newsgroups gmane.comp.gnu.m4.bugs,gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain

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.

/Simon

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQNoBAEWCAMQFiEEo8ychwudMQq61M8vUXIrCP5HRaIFAmfvzYMUHHNpbW9uQGpv
c2Vmc3Nvbi5vcmfCHCYAmDMEXJLOtBYJKwYBBAHaRw8BAQdACIcrZIvhrxDBkK9f
V+QlTmXxo2naObDuGtw58YaxlOu0JVNpbW9uIEpvc2Vmc3NvbiA8c2ltb25Aam9z
ZWZzc29uLm9yZz6IlgQTFggAPgIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgBYh
BLHSvRN1vst4TPT4xNc89jjFPAa+BQJn0XQkBQkNZGbwAAoJENc89jjFPAa+BtIA
/iR73CfBurG9y8pASh3cbGOMHpDZfMAtosu6jbpO69GHAP4p7l57d+iVty2VQMsx
+3TCSAvZkpr4P/FuTzZ8JZe8BrgzBFySz4EWCSsGAQQB2kcPAQEHQOxTCIOae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