bug formatting a .h function extern declaration with attribute macros
Eric Blake <[email protected]> Thu, 3 Apr 2025 19:46:31 -0500
| Newsgroups | gmane.comp.gnu.m4.bugs,gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <ngfptsh7ofc7zqqy2dv7dsfx5jc53e5yyr3lgr4mwkkbhutkkx@henxp44yluvn> |
I'm trying to run indent on the GNU M4 source code base before a release (it looks like gnulib added the ability to run make indent since the last time I made an m4 release). But one change that indent is insisting on is wrong: -extern void m4_error (int, int, const char *, ...) - ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((__printf__, 3, 4)); -extern void m4_error_at_line (int, int, const char *, int, const char *, ...) - ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((__printf__, 5, 6)); -extern _Noreturn void m4_failure (int, const char *, ...) +extern void +m4_error (int, int, const char *, ...) + ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((__printf__, 3, 4)); + extern void m4_error_at_line (int, int, const char *, int, const char *, + ...) + ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((__printf__, 5, 6)); + extern _Noreturn void m4_failure (int, const char *, ...) The old format may be awkward for starting the function name after the return type, but even if I break that up, emacs still recommends: extern void m4_error (int, int, const char *, ...) ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((__printf__, 3, 4)); And once indent gets messed up by the double attribute (both ATTRIBUTE_COLD and ATTRIBUTE_FORMAT are macros that expand to __attribute__ magic; the former without parameters), then the rest of the file is messed up (as seen by the four-space indent before the next extern function line). Any ideas on how to tell indent about ALL_CAPS macros that fit in attribute positions of declarations? -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org