From: Joseph Myers <joseph@codesourcery.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>
Subject: Re: [RFC] [c-family] PR92867 - Add returns_arg attribute
Date: Mon, 20 Jan 2020 23:23:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.21.2001202253430.5014@digraph.polyomino.org.uk> (raw)
In-Reply-To: <CAAgBjMk19xq3shJVX5c7eQGfcn1w3YTGFVOP1f9EmctgX6upFg@mail.gmail.com>
On Mon, 20 Jan 2020, Prathamesh Kulkarni wrote:
> Hi,
> This patch attempts to add returns_arg attribute for c-family
> languages. For C++ methods, first arg is assumed to be this pointer,
This is missing .texi documentation explaining the attribute and the cases
for which it would be useful.
A restriction to the first 4 arguments is not a good design of a language
feature, whatever implementation issues there may be.
Do you intend to update builtins.def in a followup patch for the various
built-in functions (e.g. memcpy) for which such an attribute would be
applicable?
When extracting an integer value from an INTEGER_CST provided in user
source code, you should always use tree_to_uhwi / tree_to_shwi as
appropriate, after checking the relevant tree_fits_*, rather than using
TREE_INT_CST_LOW directly, to avoid mishandling arguments that have a
small number in the low part of the INTEGER_CST but have bits set in the
high part as well. Any direct use of TREE_INT_CST_LOW should have a
specific justification for why it is correct to discard the high part of
the integer. See c-attribs.c:positional_argument, and try to use that
function if possible rather than reimplementing bits of it, so that
handling of attribute arguments giving the position of a function argument
can be as consistent as possible between different attributes.
There are coding style issues, e.g. diagnostics should not end with '.'
and lines should be broken before not after an operator.
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2020-01-20 23:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 12:21 Prathamesh Kulkarni
2020-01-20 23:23 ` Joseph Myers [this message]
2020-01-24 12:22 ` Prathamesh Kulkarni
2020-01-25 2:40 ` Joseph Myers
2020-01-27 12:46 ` Richard Biener
2020-01-28 11:47 ` Prathamesh Kulkarni
2020-01-28 11:53 ` Jakub Jelinek
2020-01-28 12:02 ` Prathamesh Kulkarni
2020-01-28 12:25 ` Jakub Jelinek
2020-01-29 10:06 ` Richard Biener
2020-01-30 12:16 ` Prathamesh Kulkarni
2020-01-30 14:10 ` Richard Biener
2020-02-03 9:12 ` Prathamesh Kulkarni
2020-02-03 9:27 ` Prathamesh Kulkarni
2020-02-04 9:24 ` Prathamesh Kulkarni
2020-02-12 6:52 ` Prathamesh Kulkarni
2020-02-12 8:35 ` Richard Biener
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.21.2001202253430.5014@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=prathamesh.kulkarni@linaro.org \
/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).