This is the mail archive of the gcc-patches@gcc.gnu.org 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: RFC - Next refactoring steps


On Thu, Sep 5, 2013 at 11:53 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Thu, Sep 5, 2013 at 5:47 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
>> ok, so to dwell on header file cleanup.   When creating new header files for
>> say, tree-ssa-ter.h,  what other include files should we make assumptions
>> have already been included... or should we make none?
>> For instance, the header files tree-ssa-ter.h would require system.h,
>> bitmap.h, tree-ssa-live.h, and gimple.h (soon to be gimple-core.h I hope :-)
>> to parse the prototypes
>
> Why bitmap.h? bitmap is in coretypes.h.
>
> Anyway, a little more side-stepping: on my wishlist is making the
> various data types (sbitmap, bitmap, sparseset, etc.) independent of
> gcc headers as much as possible, and having a single header, gccadt.h
> say, that provides most/all generic data structures (e.g. also
> including hash tables).

Yeah, and we could move all the files into a lib/ subdirectory (well, or
make them part of libiberty).

>> Of course, trimming the .c file include list with some intelligence would
>> help minimize this, but not completely eliminate it.
>
> As you may have noticed, I tried trimming the #include lists in many
> .c files last year. It's a hard but worthwhile job: You find some
> headers have to be included before others, or some headers are used by
> some .c file but they don't #include it. Instead they receive it
> through an #include in some .h file but nothing defined directly, i.e.
> not via #include, is used in the .c file.
>
>
>> thats just an example, I don't think we need a tree-ssa-ter.h. There are
>> only  3 exported functions. 2 are used exclusively in tree-outof-ssa.c and
>> one is used in expr.c  (a reuse of the is_replaceable_p function.)
>> The 2 that are exclusive to tree-out-ssa.c could simple have the prototypes
>> in tree-outof-ssa.c,   That seems like the best thing to do for single
>> client's?
>
> Not really. It's a single client now, but if it's an exported
> interface of some kind, then why should its use stay limited to a
> single client?
>
> Either some function is exported and therefore should have a prototype
> in a .h file, or something is local to a file and no prototype is
> necessary (in most cases anyway).
>
>
>> The other function could be moved from tree-ssa-ter.c to expr.c, and the
>> prototype exported in expr.h and used in tree-ssa-ter.c
>
> Makes sense.
>
> Ciao!
> Steven


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