This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 00/89] Compile-time gimple-checking
- From: Michael Matz <matz at suse dot de>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 23 Apr 2014 16:42:50 +0200 (CEST)
- Subject: Re: [PATCH 00/89] Compile-time gimple-checking
- Authentication-results: sourceware.org; auth=none
- References: <1398099480-49147-1-git-send-email-dmalcolm at redhat dot com>
On Mon, 21 Apr 2014, David Malcolm wrote:
> This is a greatly-expanded version of:
> As of r205034 (de6bd75e3c9bc1efe8a6387d48eedaa4dafe622d) and
> r205428 (a90353203da18288cdac1b0b78fe7b22c69fe63f) the various gimple
> statements form a C++ inheritance hierarchy, but we're not yet making much
> use of that in the code: everything refers to just "gimple" (or
> "const_gimple"), and type-checking is performed at run-time within the
> various gimple_foo_* accessors in gimple.h, and almost nowhere else.
> The following patch series introduces compile-time checking of much of
> the handling of gimple statements.
FWIW, I still don't like any of this for reasons already outlined here:
(basically: I consider automatically creating types a very bad idea. You
do do that by simply creating a type for every gimple code.)
> case GIMPLE_SWITCH:
> dump_gimple_switch (buffer, gs->as_a_gimple_switch (), spc, flags);
> where the ->as_a_gimple_switch is a no-op cast from "gimple" to the more
> concrete "gimple_switch" in a release build, with runtime checking for
> code == GIMPLE_SWITCH added in a checked build (it uses as_a <>
Unlike others here I do like the cast-as-method (if we absolutely _must_
have a complicated type hierarchy for gimple), but would suggest different
a name: the "gimple_" is tautological, and the "a_" just noise, just name
it "gs->as_switch()" (incidentally then it's _really_ shorter than the
ugly is_a/as_a syntax).