get rid of some shadowed variable warnings with Qt under OSX

In file included from ../win/Qt/qt_bind.cpp:20:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/QtCore:4:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qglobal.h:1302:
/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qflags.h:121:41: warning: declaration shadows a
      variable in the global namespace [-Wshadow]
    Q_DECL_CONSTEXPR inline QFlags(Enum flags) noexcept : i(Int(flags)) {}
                                        ^
[…]

../include/flag.h:390:29: note: previous declaration is here
extern NEARDATA struct flag flags;
                            ^
In file included from ../win/Qt/qt_click.cpp:18:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/QtCore:36:
/usr/local/Cellar/qt/5.15.0/lib/QtCore.framework/Headers/qcache.h:191:15: warning: declaration shadows a
      variable in the global namespace [-Wshadow]
        Node *u = n;
              ^
../include/decl.h:219:23: note: previous declaration is here
E NEARDATA struct you u;
                      ^
[…]

In file included from ../win/Qt/qt_click.cpp:18:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:5:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:45:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qtextlayout.h:47:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qcolor.h:44:
/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qrgb.h:66:46: warning: declaration shadows a
      variable in the global namespace [-Wshadow]
inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value
                                             ^
../include/decl.h:1208:27: note: previous declaration is here
E struct instance_globals g;
                          ^
[…]

In file included from ../win/Qt/qt_glyph.cpp:21:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QtGui:5:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:48:
/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qpalette.h:107:49: warning: declaration shadows a
      variable in the global namespace [-Wshadow]
    inline void setCurrentColorGroup(ColorGroup cg) { data.current_group = cg; }
                                                ^
../include/decl.h:1216:30: note: previous declaration is here
E const struct const_globals cg;
                             ^
This commit is contained in:
nhmall
2020-07-16 22:20:23 -04:00
parent eab7a12b77
commit 84b598e489
24 changed files with 81 additions and 1 deletions

View File

@@ -96,6 +96,7 @@
#endif
#ifdef QT_GRAPHICS
#include "../win/Qt/qt_redef.h"
#ifndef DEFAULT_WC_TILED_MAP
#define DEFAULT_WC_TILED_MAP /* Default to tiles if users doesn't say \
wc_ascii_map */

View File

@@ -17,6 +17,7 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#include <QtCore/QStringList>
#if QT_VERSION >= 0x050000
@@ -25,6 +26,7 @@ extern "C" {
#else
#include <QtGui/QSound>
#endif
#include "qt_redef.h"
#include "qt_bind.h"
#include "qt_click.h"
#ifdef TIMED_DELAY

View File

@@ -15,7 +15,9 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_click.h"
namespace nethack_qt_ {

View File

@@ -15,7 +15,9 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_delay.h"
namespace nethack_qt_ {

View File

@@ -18,10 +18,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_glyph.h"
#include "qt_set.h"
#include "qt_str.h"

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_icon.h"
namespace nethack_qt_ {

View File

@@ -18,10 +18,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_inv.h"
#include "qt_glyph.h"
#include "qt_set.h"

View File

@@ -15,7 +15,9 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#include "qt_redef.h"
#include "qt_key.h"
namespace nethack_qt_ {
@@ -28,9 +30,10 @@ NetHackQtKeyBuffer::NetHackQtKeyBuffer() :
bool NetHackQtKeyBuffer::Empty() const { return in==out; }
bool NetHackQtKeyBuffer::Full() const { return (in+1)%maxkey==out; }
void NetHackQtKeyBuffer::Put(int k, int a, int state)
void NetHackQtKeyBuffer::Put(int k, int a, int kbstate)
{
if ( Full() ) return; // Safety
nhUse(kbstate);
key[in]=k;
ascii[in]=a;
in=(in+1)%maxkey;

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_line.h"
namespace nethack_qt_ {

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_main.h"
#include "qt_main.moc"
#include "qt_bind.h"

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_map.h"
#include "qt_map.moc"
#include "qt_click.h"

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_menu.h"
#include "qt_menu.moc"
#include "qt_glyph.h"

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_msg.h"
#include "qt_msg.moc"
#include "qt_map.h"

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_plsel.h"
#include "qt_plsel.moc"
#include "qt_bind.h"

19
win/Qt/qt_redef.h Normal file
View File

@@ -0,0 +1,19 @@
#if defined(QT_GRAPHICS)
#if defined(MACOSX)
/*
* The following conflict with Qt header files so after
* undefing them in qt_undef.h, we redefine them back to
* the non-conflicting names again in here, presumably
* right after the Qt header files with the conflicts have
* been included.
*/
#define u NETHACK_u
#define flags NETHACK_flags
#define g NETHACK_g
#define cg NETHACK_cg
#endif /* MACOSX */
#endif /* QT_GRAPHICS */

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_rip.h"
#include "qt_bind.h"
#include "qt_str.h"

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_set.h"
#include "qt_set.moc"
#include "qt_glyph.h"

View File

@@ -17,10 +17,12 @@ extern "C" {
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_stat.h"
#include "qt_stat.moc"
#include "qt_set.h"

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_streq.h"
#include "qt_str.h"

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_svsel.h"
#include "qt_bind.h"
#include "qt_str.h"

17
win/Qt/qt_undef.h Normal file
View File

@@ -0,0 +1,17 @@
#if defined(QT_GRAPHICS)
#if defined(MACOSX)
/*
* The following conflict with Qt header files so we
* undef them in here, then redef them using qt_redef.h
* after the Qt includes.
*/
#undef u
#undef flags
#undef g
#undef cg
#endif /* MACOSX */
#endif /* QT_GRAPHICS */

View File

@@ -57,10 +57,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_win.h"
#include "qt_bind.h"
#include "qt_click.h"

View File

@@ -16,10 +16,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_xcmd.h"
#include "qt_xcmd.moc"
#include "qt_bind.h"

View File

@@ -15,10 +15,12 @@
#undef min
#undef max
#include "qt_undef.h"
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets/QtWidgets>
#endif
#include "qt_redef.h"
#include "qt_yndlg.h"
#include "qt_yndlg.moc"
#include "qt_str.h"