Introduce common/common-defs.h
authorGary Benson <gbenson@redhat.com>
Thu, 24 Jul 2014 14:35:45 +0000 (15:35 +0100)
committerGary Benson <gbenson@redhat.com>
Wed, 30 Jul 2014 08:22:49 +0000 (09:22 +0100)
This commit creates a new header, common/common-defs.h, to hold
definitions common to all code under gdb/.  Both gdb/defs.h and
gdb/gdbserver/server.h are modified to include common-defs.h as
their first non-comment line; all code under gdb/ includes either
defs.h or server.h as appropriate, so common-defs.h will be the
first actual code the compiler sees.

For this initial commit common-defs.h includes only the two
config.h files.  Future commits will move more code currently
duplicated across defs.h and server.h such that shared code in
gdb/{common,target,nat} can be modified to include common-defs.h
rather than defs.h or server.h.

gdb/
2014-07-30  Gary Benson  <gbenson@redhat.com>

* common/common-defs.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add common/common-defs.h.
* defs.h: Include common-defs.h.
Do not include config.h or build-gnulib/config.h.

gdb/gdbserver/
2014-07-30  Gary Benson  <gbenson@redhat.com>

* server.h: Include common-defs.h.
Do not include config.h or build-gnulib-gdbserver/config.h.

gdb/ChangeLog
gdb/Makefile.in
gdb/common/common-defs.h [new file with mode: 0644]
gdb/defs.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/server.h

index c836b35aa9ed517f7e5f68fabb9ac3699354fca7..bcaf17cc8522beb6440e2b6220a5ee75d6cf27ab 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-30  Gary Benson  <gbenson@redhat.com>
+
+       * common/common-defs.h: New file.
+       * Makefile.in (HFILES_NO_SRCDIR): Add common/common-defs.h.
+       * defs.h: Include common-defs.h.
+       Do not include config.h or build-gnulib/config.h.
+
 2014-07-30  Gary Benson  <gbenson@redhat.com>
 
        * common/common-utils.h: Do not include config.h.
index ce155016298fd10ff492e141b2102f7ec6339321..836103042d237ec38d4c498ce82e94d02c173909 100644 (file)
@@ -935,7 +935,7 @@ gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h nat/linux-btrace.h \
 ctf.h nat/i386-cpuid.h nat/i386-gcc-cpuid.h target/resume.h \
 target/wait.h target/waitstatus.h nat/linux-nat.h nat/linux-waitpid.h \
 common/print-utils.h common/rsp-low.h nat/i386-dregs.h x86-linux-nat.h \
-i386-linux-nat.h
+i386-linux-nat.h common/common-defs.h
 
 # Header files that already have srcdir in them, or which are in objdir.
 
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
new file mode 100644 (file)
index 0000000..9e397d9
--- /dev/null
@@ -0,0 +1,30 @@
+/* Common definitions.
+
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef COMMON_DEFS_H
+#define COMMON_DEFS_H
+
+#include "config.h"
+#ifdef GDBSERVER
+#include "build-gnulib-gdbserver/config.h"
+#else
+#include "build-gnulib/config.h"
+#endif
+
+#endif /* COMMON_DEFS_H */
index 511279af0d7f939b23ac86c4f009ee9212991653..422c4e8522e4f4128fed8eebde45ff16fe94c830 100644 (file)
@@ -25,8 +25,7 @@
 #  error gdbserver should not include gdb/defs.h
 #endif
 
-#include "config.h"            /* Generated by configure.  */
-#include "build-gnulib/config.h"
+#include "common-defs.h"
 
 #include <sys/types.h>
 #include <stdio.h>
index df20e8c2ea192df5557221852a153b6fe275a39e..d0fa61d44be58976f5eb83505883befa7a4b1557 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-30  Gary Benson  <gbenson@redhat.com>
+
+       * server.h: Include common-defs.h.
+       Do not include config.h or build-gnulib-gdbserver/config.h.
+
 2014-07-30  Gary Benson  <gbenson@redhat.com>
 
        * hostio-errno.c: Move server.h to top of includes list.
index 2d55513e17b9b477418219d273fbb5c4aa04c48e..ef66a32fd40ed554d1eac14b1a5821035dcd6db9 100644 (file)
@@ -19,8 +19,7 @@
 #ifndef SERVER_H
 #define SERVER_H
 
-#include "config.h"
-#include "build-gnulib-gdbserver/config.h"
+#include "common-defs.h"
 
 #ifdef __MINGW32CE__
 #include "wincecompat.h"