This is the mail archive of the 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]
Other format: [Raw text]

Re: [PATCH 00/89] Compile-time gimple-checking


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);
>       break;
> 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 <>
> internally).

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).


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