Avoid compilation errors in MinGW native builds of GDB
authorEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2018 16:34:46 +0000 (18:34 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2018 16:34:46 +0000 (18:34 +0200)
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  <eliz@gnu.org>

* python/python-internal.h (_hypot) [__MINGW32__]: Define back to
'hypoth'.  This avoids a compilation error.

gdb/ChangeLog
gdb/python/python-internal.h

index d232a726c39e6cd342eda4fec1be384c67f7bdcb..5369e021b32651d9ade6cfba4406be9a33fe0d45 100644 (file)
@@ -1,3 +1,25 @@
+2018-01-27  Eli Zaretskii  <eliz@gnu.org>
+
+       Avoid compilation errors in MinGW native builds
+
+       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 t
+       '_hypot' in the Windows builds.
+       * python/python-internal.h (_hypot) [__MINGW32__]: Define back to
+       'hypoth'.  This avoids a compilation error.
+
 2018-01-26  Alan Hayward  <alan.hayward@arm.com>
 
        * MAINTAINERS (Write After Approval): Fix ordering.
index f38f0b30cb8a0fc6ca94dfc989d74d04c1514c95..3f1c61fec8b45a27385324f9e2d56c6b110ab162 100644 (file)
 #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