A number of C compiler suites have a math.h library that includes a yn() function name that conflicts with NetHack's yn() macro: "The y0(), y1(), and yn() functions are Bessel functions of the second kind, for orders 0, 1, and n, respectively. The argument x must be positive. The argument n should be greater than or equal to zero. If n is less than zero, there will be a negative exponent in the result." At one point, isaac64.h included math.h, although that has since been removed. Some libraries used in NetHack (Qt for one) do include math.h and that required build work-arounds to avoid the conflict. Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict altogether, eliminating the need for that particular work-around.
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/* NetHack 3.7 qt_pre.h $NHDT-Date: 1597276835 2020/08/13 00:00:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */
|
||
|
||
/*
|
||
* qt_pre.h -- undefine some nethack macros which conflict with Qt headers.
|
||
*
|
||
* #include after "hack.h", before <Qt.../Qt...>.
|
||
*/
|
||
|
||
#undef C // conflicts with Qt6 header
|
||
#undef Invisible
|
||
#undef Warning
|
||
#undef msleep
|
||
#undef wizard
|
||
#undef min
|
||
#undef max
|
||
|
||
#ifdef NOT_C99
|
||
#ifdef NEED_INDEX
|
||
#undef index
|
||
#endif
|
||
#ifdef NEED_RINDX
|
||
#undef rindex
|
||
#endif
|
||
#endif
|
||
|
||
#if defined(__cplusplus)
|
||
|
||
#ifdef __clang__
|
||
#pragma clang diagnostic push
|
||
#endif
|
||
#ifdef __GNUC__
|
||
#pragma GCC diagnostic push
|
||
#endif
|
||
/* the diagnostic pop is in qt_post.h */
|
||
|
||
#ifdef __clang__
|
||
/* disable warnings for shadowed names; some of the Qt prototypes use
|
||
placeholder argument names which conflict with nethack variables
|
||
('g', 'u', a couple of others) */
|
||
#pragma clang diagnostic ignored "-Wshadow"
|
||
#elif defined(__GNUC__)
|
||
#pragma GCC diagnostic ignored "-Wshadow"
|
||
#endif
|
||
|
||
#include <QtGlobal>
|
||
|
||
/* QFontMetrics::width was deprecated in Qt 5.11 */
|
||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||
#define QFM_WIDTH(foo) width(foo)
|
||
#else
|
||
#define QFM_WIDTH(foo) horizontalAdvance(foo)
|
||
#endif
|
||
|
||
#if __cplusplus >= 202002L
|
||
/* c++20 or newer */
|
||
#if QT_VERSION < 0x060000
|
||
/*
|
||
* qt5/QtWidgets/qsizepolicy.h
|
||
* Qt5 header file issue under c++ 20
|
||
*
|
||
* warning: bitwise operation between different enumeration types
|
||
* ‘QSizePolicy::Policy’ and ‘QSizePolicy::PolicyFlag’
|
||
* is deprecated [-Wdeprecated-enum-enum-conversion]
|
||
*/
|
||
#if defined(__GNUC__)
|
||
#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion"
|
||
#endif
|
||
#if defined(__clang__)
|
||
#pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"
|
||
#endif
|
||
#endif /* QT_VERSION < 0x060000 */
|
||
#endif /* __cplusplus >= 202002L */
|
||
#endif /* __cplusplus */
|
||
|
||
/*qt_pre.h*/
|
||
|