[C PATCH] Disallow subtracting pointers to empty structs (PR c/58346)

Florian Weimer fweimer@redhat.com
Tue Jan 14 17:52:00 GMT 2014


On 01/13/2014 09:48 PM, Marek Polacek wrote:
> +bool
> +pointer_to_zero_sized_aggr_p (tree t)
> +{
> +  t = strip_pointer_operator (t);
> +  if (RECORD_OR_UNION_TYPE_P (t)
> +      && TYPE_SIZE (t)
> +      && integer_zerop (TYPE_SIZE (t)))
> +    return true;
> +  return false;
> +}

I think you can just return the value of the condition, there's no need 
for the if statement.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Gcc-patches mailing list