Correctly indenting preprocessor macros in header files with guards
Darshit Shah <[email protected]> Tue, 8 May 2018 16:09:28 +0200
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <[email protected]> |
--===============5180464119914170668== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qusw3hkblaa3knt2" Content-Disposition: inline --qusw3hkblaa3knt2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I'm trying to use indent on an existing C source which contains header files with preprocessor statements. As is common in C, the headers are all surrounded by guard statements, so t= he final header file looks like this: ``` #ifndef _MY_HEADER_H #define _MY_HEADER_H #define FOO bar #endif ``` Here, the `#define` is not really defined one level deep. Yet, using the `-= ppi` option will cause this file to be formatted like this: ``` #ifndef _MY_HEADER_H #define _MY_HEADER_H # define FOO bar #endif ``` Is there any way to teach GNU Indent about the idea of header guards so as = to prevent it from formatting all preprocessor command in a header file with 1 level too deep of indentation? --=20 Thanking You, Darshit Shah PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6 --qusw3hkblaa3knt2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJnBAABCgBRFiEEa5j2N9h5xSNuJ3xcZP+QqujHCvkFAlrxr4QzFIAAAAAAFQAV cGthLWFkZHJlc3NAZ251cGcub3JnZGFybmlybWxpc3RAZ21haWwuY29tAAoJEGT/ kKroxwr5PwwQALnW1VvQSlE4aCth6mSlI8438f815JadWXwA0KOV/LUOoLiUbMU4 EwJscp/e9GokuxZsp6tYGgh22FN34vL8/0vfuSrbLkn6MtOZ0HO3jUfN5WLAkjJI RgmaTnF6oXdmO/lrW4nc0Q7hHPF6Mqoa1PWKkynf9kZywRN1Afj08LSQi5JR3L1q nc49imknrJWd+SbElTxqLLJ+9zXBYzADICk/Czo7x/sVOEPaDXsPMsfbXts/GDdt VQp+O12Za0Hqutbh5NG65JCszQf48+HEPy0ju3C+WnV1Pg5je/CIQrkuUFPxjUgU WO3hXIBAMI/PTjIzXrA1dWGlO9+h1XGkTdh7wM7mHS81wdMTm/RmNvuIR74DUJeU DdJQ79Q/8GwW7cOJmPqeydzZii1o3XDnKm7MJs2a7MKJK1BBn/hIvSc2lXrnuSaw XGgyjnSiSG6UMiJvwv3Ze7Z8r2t8Km3YaY//xSjG08V3XjKCS7WNBX7Y4BJMEynm mmOhp6lCfnL2Xdc6PZ2FPrm//eLYgxV8LlgnDqyHLaLaKm/3as0QB7RdAnSc1aKZ QSh/SFXHZ1Fv0MxRqUvwG0BbQns4XapgG62bI5aGYV07InnT0eGUR1Rx9331InA6 CNwhWXH/HRH0UDdi2y61sz8aZ6clvuvFbfZPVpHR6qdjkjzBxF3wTlnH =Zw8e -----END PGP SIGNATURE----- --qusw3hkblaa3knt2-- --===============5180464119914170668== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ bug-indent mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-indent --===============5180464119914170668==--