This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jakub Jelinek <jakub at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Richard Biener <rguenther at suse dot de>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 16 Jan 2014 12:50:10 +0100
- Subject: Re: [C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)
- Authentication-results: sourceware.org; auth=none
- References: <20140113163226 dot GD4458 at redhat dot com> <20140115103540 dot GY892 at tucnak dot redhat dot com> <20140115135037 dot GL4458 at redhat dot com>
> +/* Return true if T is a pointer to a zero-sized struct/union. */
> +
> +bool
> +pointer_to_zero_sized_aggr_p (tree t)
> +{
> + t = strip_pointer_operator (t);
> + return ((RECORD_OR_UNION_TYPE_P (t) || TREE_CODE (t) == ARRAY_TYPE)
> + && TYPE_SIZE (t)
> + && integer_zerop (TYPE_SIZE (t)));
> +}
That's AGGREGATE_TYPE_P (and the comment seems to be out-of-sync).
--
Eric Botcazou