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] Fix C++ compilation on MinGW


From: Orgad Shaneh <orgads@gmail.com>

When compiling with MinGW, pyconfig.h renames hypot to _hypot.

If math.h is included later, hypot is not declared correctly.

When g++ is used, it has 'using ::hypot', which doesn't exist.
---
 gdb/python/python-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 8545c7b..9b43255 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -88,6 +88,10 @@
 /* Request clean size types from Python.  */
 #define PY_SSIZE_T_CLEAN
 
+// math.h has to be included before Python.h, since pyconfig.h
+// renames hypot to _hypot, and this breaks MinGW compilation with g++.
+#include <math.h>
+
 /* Include the Python header files using angle brackets rather than
    double quotes.  On case-insensitive filesystems, this prevents us
    from including our python/python.h header file.  */
-- 
2.10.1.windows.1


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