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] Use more DECL_BUILT_IN_P macro.


On 08/27/2018 06:02 PM, Martin Sebor wrote:
> On 08/27/2018 01:20 AM, Martin Liška wrote:
>> +/* For a FUNCTION_DECL NODE, nonzero means a built in function of a
>> + standard library or more generally a built in function that is
>> + recognized by optimizers and expanders.

Hi.

Thanks for help with that.

> 
> I'm a little confused by this description: the last part makes
> me wonder about what a true value implies about a function.  It
> sounds like the function returns true for any built-in, library
> or otherwise, correct (i.e., including a front-end built-in)?
> If yes, then maybe drop the part about standard library functions?
> Say:
> 
>   Return true if a FUNCTION_DECL NODE is a GCC built-in function.

Yes, it's better!

> 
> 
>> +
>> + Note that it is different from the DECL_IS_BUILTIN accessor. For
>> + instance, user declared prototypes of C library functions are not
>> + DECL_IS_BUILTIN but may be DECL_BUILT_IN.
>> +
>> + When a NULL argument is pass or tree code of the NODE is not
>> FUNCTION_DECL
>> + false is returned. */
> 
> "Passed" -- so perhaps "When NODE is null..."

Ho be honest this part became out of date, I'm going to remove that.

There's a part that I'm going to install.

Martin

> 
> Martin
> 
>> +
>> +inline bool
>> +fndecl_built_in_p (const_tree node)
>> +{
>> + return (node != NULL_TREE
>> + && DECL_BUILT_IN_CLASS (node) != NOT_BUILT_IN);
>> +}
> 

>From b6a2c3c2bfccb1528f11db3e829657199d8b0eba Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 28 Aug 2018 09:15:43 +0200
Subject: [PATCH] Update documentation of fndecl_built_in_p.

gcc/ChangeLog:

2018-08-28  Martin Liska  <mliska@suse.cz>

	* tree.h: Update documentation of fndecl_built_in_p
	functions.
---
 gcc/tree.h | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/gcc/tree.h b/gcc/tree.h
index db04eb7e58b..562a88b8aff 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5834,16 +5834,11 @@ type_has_mode_precision_p (const_tree t)
   return known_eq (TYPE_PRECISION (t), GET_MODE_PRECISION (TYPE_MODE (t)));
 }
 
-/* For a FUNCTION_DECL NODE, nonzero means a built in function of a
-   standard library or more generally a built in function that is
-   recognized by optimizers and expanders.
+/* Return true if a FUNCTION_DECL NODE is a GCC built-in function.
 
    Note that it is different from the DECL_IS_BUILTIN accessor.  For
    instance, user declared prototypes of C library functions are not
-   DECL_IS_BUILTIN but may be DECL_BUILT_IN.
-
-   When a NULL argument is pass or tree code of the NODE is not FUNCTION_DECL
-   false is returned.  */
+   DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
 
 inline bool
 fndecl_built_in_p (const_tree node)
@@ -5851,8 +5846,8 @@ fndecl_built_in_p (const_tree node)
   return (DECL_BUILT_IN_CLASS (node) != NOT_BUILT_IN);
 }
 
-/* For a FUNCTION_DECL NODE, return true when a function is
-   a built-in of class KLASS.  */
+/* Return true if a FUNCTION_DECL NODE is a GCC built-in function
+   of class KLASS.  */
 
 inline bool
 fndecl_built_in_p (const_tree node, built_in_class klass)
@@ -5860,8 +5855,8 @@ fndecl_built_in_p (const_tree node, built_in_class klass)
   return (fndecl_built_in_p (node) && DECL_BUILT_IN_CLASS (node) == klass);
 }
 
-/* For a FUNCTION_DECL NODE, return true when a function is
-   a built-in of class KLASS with name equal to NAME.  */
+/* Return true if a FUNCTION_DECL NODE is a GCC built-in function
+   of class KLASS with name equal to NAME.  */
 
 inline bool
 fndecl_built_in_p (const_tree node, int name, built_in_class klass)
@@ -5869,8 +5864,8 @@ fndecl_built_in_p (const_tree node, int name, built_in_class klass)
   return (fndecl_built_in_p (node, klass) && DECL_FUNCTION_CODE (node) == name);
 }
 
-/* For a FUNCTION_DECL NODE, return true when a function is
-   a built-in of class BUILT_IN_NORMAL class with name equal to NAME.  */
+/* Return true if a FUNCTION_DECL NODE is a GCC built-in function
+   of BUILT_IN_NORMAL class with name equal to NAME.  */
 
 inline bool
 fndecl_built_in_p (const_tree node, built_in_function name)
-- 
2.18.0


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