public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: <gcc@gcc.gnu.org>
Subject: Re: No-named-argument variadic functions
Date: Thu, 20 Oct 2022 16:35:20 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2210201627430.71947@digraph.polyomino.org.uk> (raw)
In-Reply-To: <CAFiYyc1vsvqfTH=xSn0wdDQEO+QMd9-Fodf+ncx1yjszOTZOgg@mail.gmail.com>

On Thu, 20 Oct 2022, Richard Biener via Gcc wrote:

> > 1. How should (...) be represented differently from unprototyped functions
> > so that stdarg_p and prototype_p handle it properly?  Should I add a new
> > language-independent type flag (there are plenty spare) to use for this?
> 
> I'd say unprototyped should stay with a NULL TYPE_ARG_TYPES but
> a varargs function might change to have a TREE_LIST with a NULL type
> as the trailing element?  Not sure if we want to change this also for
> varargs functions with actual arguments.
> 
> If we want to go down the route with a flag on the function type then
> I'd rather flag the unprototyped case and leave varargs without any
> actual arguments as NULL TYPE_ARG_TYPES?

The issue with both of those options is that they don't seem very safe for 
code that accesses TYPE_ARG_TYPES directly, of which I think we have a 
lot.  Such code is quite likely to fall over on a TREE_LIST with a NULL 
type entry, and having code that encounters a (...) prototype treat it 
like an unprototyped function seems safer than having code that encounters 
an unprototyped function treat it like a (...) prototype because the code 
that created the function type failed to set a flag to say it's 
unprototyped.

(In principle TYPE_ARG_TYPES could change to have static type other than 
tree, with explicit flags both for stdarg_p and for prototype_p, which 
would provide GCC-build-time assurance that there's no non-updated code 
left that expects an old representation.  But that would be a very large 
change.)

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2022-10-20 16:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 23:53 Joseph Myers
2022-10-20  6:00 ` Richard Biener
2022-10-20 16:35   ` Joseph Myers [this message]

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=alpine.DEB.2.22.394.2210201627430.71947@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@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).