This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Always include defs.h first.
- From: Tom Tromey <tromey at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>, gdb-patches at sourceware dot org
- Date: Thu, 08 Nov 2012 12:37:16 -0700
- Subject: Re: [PATCH] Always include defs.h first.
- References: <20121107201107.25258.47267.stgit@brno.lan> <000301cdbdd3$1b0f7780$512e6680$@muller@ics-cnrs.unistra.fr> <509BE8F3.4090605@redhat.com>
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> Yeah. They're getting it from those headers. IMO, this makes it
Pedro> easy to forget about it, and risk some change adding the inclusion
Pedro> of a system header before including py-events.h, etc. But since
Pedro> we don't have consensus, I'll leave it at that.
My view is that the uses of defs.h in python/*.h are just review errors.
If I had noticed this when the patches went in, I would have prevented
it.
Furthermore I think it doesn't really make sense to approach this
halfway. There's no principled reason that only python/*.c should fail
to include defs.h first. It makes gdb less consistent but not to any
end.
Finally, the defs.h rule is in gdbint.texinfo.
On the basis of this last point, I am committing the appended.
Tested by rebuilding.
Tom
2012-11-08 Tom Tromey <tromey@redhat.com>
* python/py-bpevent.c: Include defs.h.
* python/py-continueevent.c: Include defs.h.
* python/py-event.c: Include defs.h.
* python/py-event.h: Don't include defs.h.
* python/py-events.h: Don't include defs.h.
* python/py-evts.c: Include defs.h.
* python/py-exitedevent.c: Include defs.h.
* python/py-newobjfileevent.c: Include defs.h.
* python/py-signalevent.c: Include defs.h.
* python/py-stopevent.c: Include defs.h.
* python/py-threadevent.c: Include defs.h.
Index: python/py-bpevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-bpevent.c,v
retrieving revision 1.4
diff -u -r1.4 py-bpevent.c
--- python/py-bpevent.c 15 Aug 2012 14:22:02 -0000 1.4
+++ python/py-bpevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-stopevent.h"
static PyTypeObject breakpoint_event_object_type;
Index: python/py-continueevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-continueevent.c,v
retrieving revision 1.3
diff -u -r1.3 py-continueevent.c
--- python/py-continueevent.c 1 Mar 2012 21:06:54 -0000 1.3
+++ python/py-continueevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-event.h"
static PyTypeObject continue_event_object_type;
Index: python/py-event.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-event.c,v
retrieving revision 1.4
diff -u -r1.4 py-event.c
--- python/py-event.c 15 Aug 2012 14:22:02 -0000 1.4
+++ python/py-event.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-event.h"
void
Index: python/py-event.h
===================================================================
RCS file: /cvs/src/src/gdb/python/py-event.h,v
retrieving revision 1.5
diff -u -r1.5 py-event.h
--- python/py-event.h 4 Jan 2012 08:17:25 -0000 1.5
+++ python/py-event.h 8 Nov 2012 19:31:13 -0000
@@ -20,7 +20,6 @@
#ifndef GDB_PY_EVENT_H
#define GDB_PY_EVENT_H
-#include "defs.h"
#include "py-events.h"
#include "command.h"
#include "python-internal.h"
Index: python/py-events.h
===================================================================
RCS file: /cvs/src/src/gdb/python/py-events.h,v
retrieving revision 1.4
diff -u -r1.4 py-events.h
--- python/py-events.h 4 Jan 2012 08:17:25 -0000 1.4
+++ python/py-events.h 8 Nov 2012 19:31:13 -0000
@@ -20,7 +20,6 @@
#ifndef GDB_PY_EVENTS_H
#define GDB_PY_EVENTS_H
-#include "defs.h"
#include "command.h"
#include "python-internal.h"
#include "inferior.h"
Index: python/py-evts.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-evts.c,v
retrieving revision 1.4
diff -u -r1.4 py-evts.c
--- python/py-evts.c 4 Jan 2012 08:17:25 -0000 1.4
+++ python/py-evts.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-events.h"
/* Initialize python events. */
Index: python/py-exitedevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-exitedevent.c,v
retrieving revision 1.5
diff -u -r1.5 py-exitedevent.c
--- python/py-exitedevent.c 15 Aug 2012 14:22:02 -0000 1.5
+++ python/py-exitedevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-event.h"
static PyTypeObject exited_event_object_type;
Index: python/py-newobjfileevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-newobjfileevent.c,v
retrieving revision 1.5
diff -u -r1.5 py-newobjfileevent.c
--- python/py-newobjfileevent.c 6 Sep 2012 20:14:13 -0000 1.5
+++ python/py-newobjfileevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-event.h"
static PyTypeObject new_objfile_event_object_type;
Index: python/py-signalevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-signalevent.c,v
retrieving revision 1.4
diff -u -r1.4 py-signalevent.c
--- python/py-signalevent.c 15 Aug 2012 14:22:02 -0000 1.4
+++ python/py-signalevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-stopevent.h"
static PyTypeObject signal_event_object_type;
Index: python/py-stopevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-stopevent.c,v
retrieving revision 1.6
diff -u -r1.6 py-stopevent.c
--- python/py-stopevent.c 15 Aug 2012 14:22:02 -0000 1.6
+++ python/py-stopevent.c 8 Nov 2012 19:31:13 -0000
@@ -17,6 +17,7 @@
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 "defs.h"
#include "py-stopevent.h"
PyObject *
Index: python/py-threadevent.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-threadevent.c,v
retrieving revision 1.3
diff -u -r1.3 py-threadevent.c
--- python/py-threadevent.c 15 Aug 2012 14:22:02 -0000 1.3
+++ python/py-threadevent.c 8 Nov 2012 19:31:13 -0000
@@ -15,6 +15,7 @@
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 "defs.h"
#include "py-event.h"
/* thread events can either be thread specific or process wide. If gdb is