This is the mail archive of the gcc@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]

Re: build_type_variant() and the restrict type qualifier


Joesph, thanks for the reply. 

On Feb 27,  1:15am, Joseph S. Myers wrote:
> > 
> > Is it acceptable for the call above to build_type_variant to be
> > rewritten as:
> > 
> >      fntype = build_qualified_type (TREE_TYPE (function), TYPE_QUALS(function));
> 
> I don't see why not - functions shouldn't be restrict qualified.

Something that I notice in the latest CVS tree is that the
macros that extract type qualifiers have been augmented with new macros
for specific contexts:

/* The set of type qualifiers for this type.  */
#define TYPE_QUALS(NODE)                                        \
  ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)                     \
   | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)                \
   | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)                \
   | (BOUNDED_INDIRECT_TYPE_P (NODE) * TYPE_QUAL_BOUNDED))

/* The set of qualifiers pertinent to an expression node.  */
#define TREE_EXPR_QUALS(NODE)                           \
  ((TREE_READONLY (NODE) * TYPE_QUAL_CONST)             \
   | (TREE_THIS_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)   \
   | (TREE_BOUNDED (NODE) * TYPE_QUAL_BOUNDED))

/* The set of qualifiers pertinent to a FUNCTION_DECL node.  */
#define TREE_FUNC_QUALS(NODE)                           \
  ((TREE_READONLY (NODE) * TYPE_QUAL_CONST)             \
   | (TREE_THIS_VOLATILE (NODE) * TYPE_QUAL_VOLATILE))

which should help clarify a few of the different contexts (though
as you pointed out in your reply, there are probably still a few
places where `restrict' isn't being propagated - and perhaps the
newly added `bounded' qualifier as well).


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