This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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 1/3 v4] Introduce common/errors.h


Doug Evans wrote:
> Pedro Alves writes:
> > > +   You should have received a copy of the GNU General Public License
> > > +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> > > +
> > > +#include "config.h"
> > 
> > Sorry for the push back, but it's wrong to only include "config.h".
> > We need to include gnulib's config.h everywhere too.  I think
> > the best is to add a central common header that handles that
> > detail first.
> 
> OTOH,
> just including "config.h" is a real common thing to do across all
> packages.  I can imagine this coming up again and again.
> 
> IWBN if hacking on gdb didn't require special cases to standard
> programming paradigms wherever possible.  Can we arrange for
> config.h to include gnulib's config.h?  Or, another thought would be
> to have configure generate gdb-config.h (or some such) and then have
> src/gdb/config.h include both (and similarly for gdbserver - haven't
> looked at the details though).

I'm working on this now.  My plan is to have gdb/common/common-defs.h
(which includes config.h and the correct gnulib config.h) and have
defs.h and server.h include common-defs.h as the first line.  By the
end of that series most every file will include defs.h or server.h
and no file will include config.h.

At the first instance common-defs.h will include most files included
by both defs.h and server.h.  There are various workarounds for
various things in both, and it would be good to have these workarounds
the same for all of GDB/gdbserver/etc.  I plan to omit alloca.h and
errno.h initially, as these have pretty heavy hacking around them and
they're not needed yet.  I'll probably do both at some point, but as
individual patches/serieses.

I'm also going to do some #include cleanups as part of the same
series.  For example lots of things include common-utils.h, but
that's currently included by defs.h and server.h (so I'll move it
to common-defs.h) and if every file includes common-defs.h somehow
then nothing needs common-utils.h.

Once the common-defs.h series is finished and pushed I'll rebase
this common-cleanups series on top of it.  It'll be much cleaner
and by then the number of "#ifdef GDBSERVER"s in the codebase
will be precisely one (to select the appropriate gnulib config.h
in common-defs.h).

Does all this sound ok?

Cheers,
Gary

-- 
http://gbenson.net/


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