From b2a426e2c5632644b6b8bc0dde4cd32d42d548e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 27 Jan 2018 18:34:46 +0200 Subject: Avoid compilation errors in MinGW native builds of GDB The error is triggered by including python-internal.h, and the error message is: In file included from d:\usr\lib\gcc\mingw32\6.3.0\include\c++\math.h:36:0, from build-gnulib/import/math.h:27, from d:/usr/Python26/include/pyport.h:235, from d:/usr/Python26/include/Python.h:58, from python/python-internal.h:94, from python/py-arch.c:24: d:\usr\lib\gcc\mingw32\6.3.0\include\c++\cmath:1157:11: error: '::hypot' has not been declared using ::hypot; ^~~~~ This happens because Python headers define 'hypot' to expand to '_hypot' in the Windows builds. gdb/ChangeLog: 2018-01-27 Eli Zaretskii * python/python-internal.h (_hypot) [__MINGW32__]: Define back to 'hypoth'. This avoids a compilation error. --- gdb/python/python-internal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/python') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index f38f0b3..3f1c61f 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -85,6 +85,12 @@ #define HAVE_SNPRINTF 1 #endif +/* Another kludge to avoid compilation errors because MinGW defines + 'hypot' to '_hypot', but the C++ headers says "using ::hypot". */ +#ifdef __MINGW32__ +# define _hypot hypot +#endif + /* Request clean size types from Python. */ #define PY_SSIZE_T_CLEAN -- cgit v1.1