public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Gabriel Ravier <gabravier@gmail.com>,
	Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [C2x] Disallow function attributes after function identifier
Date: Sat, 11 Jun 2022 22:20:47 +0200	[thread overview]
Message-ID: <d37a2714-581e-17b5-cb7e-474ee30136e9@gmail.com> (raw)
In-Reply-To: <02b74788-43b3-da53-8f3b-3b114329f8d6@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1817 bytes --]

On 6/11/22 14:08, Gabriel Ravier wrote:

>  > Do we want to add a completely unnecessary feature, just for symmetry 
> with C++, even if it poses a danger of breaking (both human and script) 
> readability of function declarations/definitions, especially when hidden 
> in macros?
> 
> I actually don't get the trouble with this. Your tool already can't 
> parse declarations if they don't follow a certain coding style, so you 
> can just add this restriction to the coding style that's required.

True-ish.  But when I mean that my tool requires a same coding style, I 
mean that it just requires that the code hasn't been written by some 
monkey.  Things that are not correctly parsed by my tool are of this kind:

int foo(void)
  {
      return 7;
      }

or

#define empty

int foo empty(void)
{
     return 42;
}

Modulo errors in the regexes, any rational indentation is supported 
(except for K&R definitions, which are also impossible to parse with a 
regex, but ISO C deprecated them a long time ago).

> 
>  > I still have the hope that if the feature is finally kept in C23, 
> absolutely no-one will ever use it, but then I question the introduction 
> in the first place.
> 
> Well in the same way, `int long signed const typedef long x;` is valid 
> C, and I do hope that nobody will ever use it, but I don't think we 
> should change C's grammar to disallow it.

Fair point :)


Cheers,

Alex


P.S.: Please consider deprecating 'auto' some day.  It would be nice to 
see C++'s auto in ISO C some day, even if it's 2060.  I'm not entirely 
happy doing `#define auto __auto_type` (of course it's UB, but it's nice) ;)


-- 
Alejandro Colomar
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-06-11 20:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 20:40 Alejandro Colomar
2022-06-10 21:09 ` Joseph Myers
2022-06-10 21:35   ` Alejandro Colomar
2022-06-10 21:16 ` Jakub Jelinek
2022-06-10 21:31   ` Alejandro Colomar
2022-06-10 22:47     ` Jonathan Wakely
2022-06-11  9:03       ` Alejandro Colomar
2022-06-11 12:08         ` Gabriel Ravier
2022-06-11 20:20           ` Alejandro Colomar [this message]
2022-06-13 15:54             ` Jonathan Wakely
2022-06-11 12:53         ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d37a2714-581e-17b5-cb7e-474ee30136e9@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=gabravier@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).