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]

[PATCH 0/3] config.h rationalization


Hi all,

A couple of times during the common-cleanups review I've tripped over
including config.h the wrong way.  This series attempts to rationalize
this across all source files by moving the two config.h includes into
one file and ensuring all source files include that file first.

Both defs.h and server.h include the two config.h files as their very
first non-comment lines.  Most source files under gdb/ include either
defs.h or server.h as their first non-comment lines.  The first patch
in the series modifies these few files such that all source files (.c)
under gdb/ include either defs.h or server.h as their first non-comment
line.  An exception is made for gdb/gdbserver/gdbreplay.c which seems
to be a special case.

A number of files under gdb/ include the non-gnulib config.h directly.
The second patch in the series removes these now-redundant includes.

The third patch creates a new header, common/common-defs.h, and moves
the two config.h includes into that.  defs.h and server.h are modified
to include common/common-defs.h as their first non-comment lines.

defs.h and server.h contain a certain amount of common code (identical
include files, that kind of thing).  They also contain (in some cases
divergent) workarounds for the lack of certain headers and definitions.
My intention, in a future series, is to move this common code into
common-defs.h such that part of the GDB coding standard becomes:

 .c files under gdb/{common,target,nat} shall include common-defs.h
 as their first non-comment line.

 .c files under gdb/gdbserver shall include server.h as their first
 non-comment line.

 All other .c files under gdb/ shall include defs.h as their first
 non-comment line.

 No file under gdb/ shall include either config.h file directly.

 No .h file under gdb/ shall include common-defs.h, defs.h or server.h.

I am aware that the first patch in the series creates some redundant
includes, for example common/ptid.c now includes defs.h or server.h,
both of which include ptid.h, but I did not remove the "#include ptid.h"
from ptid.c.  I intend to address these redundant includes as common
code is migrated into common-defs.h.

Built and regtested on RHEL6.5 x86_64.  mips-linux-watch.c changes
checked by cross-building gdbserver with the Sourcery CodeBench for
MIPS GNU/Linux toolchain.

Is this series ok to commit?

Thanks,
Gary

--
http://gbenson.net/


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