This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] enhance overflow and truncation detection in strncpy and strncat (PR 81117)


On 08/14/2017 12:09 PM, Joseph Myers wrote:
On Mon, 14 Aug 2017, Martin Sebor wrote:

I assumed every attribute needed to define an identifier but
nothing broke after I removed it so it looks like you're right
variable attributes don't need one.  Go figure.  It would be
nice if there was a comment above the block that mentioned that.
I'll try to remember to add one separately.

builtin-attrs.def is only for attributes used in defining built-in
functions.  If no built-in function uses an attribute, it should not be
defined there.

Okay, thanks for confirming that.  Here's a patch to make it
clear.  Please let me know if it's okay to commit.

Martin

2017-08-14  Martin Sebor  <msebor@redhat.com>

	* builtin-attrs.def: Add comments.

Index: gcc/builtin-attrs.def
===================================================================
--- gcc/builtin-attrs.def	(revision 251097)
+++ gcc/builtin-attrs.def	(working copy)
@@ -18,7 +18,9 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */

 /* This header provides a declarative way of describing the attributes
-   that are applied to some functions by default.
+   that are applied to some built-in functions by default.  Attributes
+   that apply to types or variables but not functions need not and
+   should not be defined here.

    Before including this header, you must define the following macros.
    In each case where there is an ENUM, it is an identifier used to
@@ -85,7 +87,7 @@ DEF_LIST_INT_INT (5,0)
 DEF_LIST_INT_INT (5,6)
 #undef DEF_LIST_INT_INT

-/* Construct trees for identifiers.  */
+/* Construct trees for identifiers used in function attributes.  */
 DEF_ATTR_IDENT (ATTR_ALLOC_SIZE, "alloc_size")
 DEF_ATTR_IDENT (ATTR_COLD, "cold")
 DEF_ATTR_IDENT (ATTR_CONST, "const")


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]