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 jos...@codesourcery.com