This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Adding _Dependent_ptr type qualifier in C part 1/3
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Akshat Garg <xkspr7 at gmail dot com>
- Cc: Martin Sebor <msebor at gmail dot com>, <gcc-patches at gcc dot gnu dot org>, Paul McKenney <paulmckrcu at gmail dot com>, Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- Date: Thu, 29 Aug 2019 20:41:48 +0000
- Subject: Re: [PATCH] Adding _Dependent_ptr type qualifier in C part 1/3
- Ironport-sdr: cbGzZ9dpqQ+JTJhnaJF+2rSNY+b36Be4qZSbLi81TkNSFmUuEogunHi5I4ZTYr64eiDvf7Ogn4 QFzIJvv8fHJ7NqVV8nFfh8IWvD3FdOaMsqEkB0wGb4bvNHdBBxQbQUgz1UiVflQoUkDB02HCRy C/3zm2BIc9M7AQ6XSgeR78QhoLElPrIyVPgPhFHY0WUqlC/4Q4M91mqA3rY5vYy0h0g6YmdOKl XANmLy5UfIA05p3Zc0s8m2cKcXsdK6B6tlj3nZQ1F+bT9me3VjfS4wdLtXGkZbOd0rJkjJlg4n Jsk=
- Ironport-sdr: I3y0QL+UNQA2eYV2dYXrCrUc5QDGw/bCAthpsWYUwItr5PjV/+4Y84GqSeeWS9BdaTn9Rq7fjM IIcoQ4xIe4nGnT5z3hhCDQoz+8JGy9J215QnlNVR836hIpXzwxnxvCjihDsfRW6/jg2z0krYRI juupQnEd51M5LjGZxO3LWTPUtJRUloaXOUWq1FNsjr7mktha4KIEXh4yuWLrB+wYO0hewSgD5y DGt+GSMReMhQjCAG1PIjJ0Rb/kYVJCRfSG10lkw3OLfs3a5OaitDUYMGudBEPFdL381Irpz2cL C0g=
- References: <CAMEQ7YzmTgrrtdqtr8e+Y8dCrXFamhX-U30sCkg921o0+KaSkw@mail.gmail.com> <firstname.lastname@example.org> <alpine.DEB.email@example.com> <CAMEQ7Yx60Amkp0cpgjO2a6rpO6qhun7Gp41oikO_mjCY1jeziA@mail.gmail.com>
On Fri, 30 Aug 2019, Akshat Garg wrote:
> > The first question for any new thing that is syntactically a qualifier is:
> > is it intended generally to be counted as a qualifier where the standard
> > refers to qualified type, the unqualified version of a type, etc.? Or is
> > it, like _Atomic, a qualifier only syntactically and generally excluded
> > from references to qualifiers?
> Can you help me in understanding why the _Atomic is excluded from the
> standard references. I referred to the C standard draft N2310 (
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2310.pdf) but I couldn't
> understand how it is excluded? I want to know what properties should a
> qualifier have to be in standard qualifiers list?
In the case of _Atomic, it can affect the size and alignment of the type
to which it is applied, which means it can't be considered a qualifier in
the nornal semantic sense.
In general you need to consider questions such as: is it safe to convert a
pointer to unqualified type to a pointer to the corresponding
_Dependent_ptr-qualified type? Are conditional expressions between
pointers whose target types differ in presence or absence of
_Dependent_ptr safe? If in general, in such places where the standard
refers to qualifiers, the existing logic there is also appropriate for
_Dependent_ptr, that suggests it should be a qualifier semantically. If
the standard logic often seems inappropriate for _Dependent_ptr, that
indicates it's not a qualifier in standard terms.
Joseph S. Myers