Re: Fix build-failure of gdb in python.c

Joel Brobecker
2010-01-18T10:55:00Z

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

> in file python/python.c is the method throw_error with constant
> UNSUPPORTED_ERROR used, but the header exceptions.h isn't included, so I
> get a build failure. I am not sure if this happens for other targets, too.
> The attached patch fixes this by adding the necessary include.

Outch, sorry. My mistake. I had seen that exceptions.h might be needed
if !HAVE_PYTHON, but was lazy and only did a visual check. I should
have attempted a build --without-python.

> 2010-01-18 Kai Tietz <kai.tietz@onevision.com>
>
> * python/python.c: Add include of exception.h header.

Unfortunately, this is not the right fix. 2 things:
- The needed include was conditionalized on HAVE_PYTHON, so the
right fix was simply to move the #include out of the conditionalized
section;
- the right include is "exceptions.h", not "../exceptions.h".
Sources in python/ are compiled from the gdb/ subdirectory.

I have applied the following patch to fix the problem.

2010-01-18 Joel Brobecker <brobecker@adacore.com>

Fix build failure when building without Python support.
* python/python.c: Always include exceptions.h, even when HAVE_PYTHON
is not defined.

Tested by rebuilding GDB --with-python and --without-python.

--
Joel

[-- Attachment #2: python.diff --]
[-- Type: text/x-diff, Size: 637 bytes --]

Index: python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.24
diff -u -p -r1.24 python.c
--- python/python.c 18 Jan 2010 06:25:22 -0000 1.24
+++ python/python.c 18 Jan 2010 10:50:11 -0000
@@ -27,6 +27,7 @@
#include "observer.h"
#include "value.h"
#include "language.h"
+#include "exceptions.h"

#include <ctype.h>

@@ -45,7 +46,6 @@ static int gdbpy_auto_load = 1;
#include "cli/cli-decode.h"
#include "charset.h"
#include "top.h"
-#include "exceptions.h"
#include "python-internal.h"
#include "version.h"
#include "target.h"