Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.3
-
None
-
macOS 10.13, Xcode 10.1
-
-
d62ee142839ff78134d6d4a48acfdd11040ceeae (qt/qtbase/5.13) 6bd35e47080b3ddfe14543f805e744846e245c2f (qt/qtbase/5.12)
Description
#include <ApplicationServices/ApplicationServices.h>On macOS with Qt 5.12.3, if I compile this code with -Wshadow, I get a compiler warning.
#include <ApplicationServices/ApplicationServices.h> #include <QtGui> #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); return a.exec(); }
Here is the compiler output:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -Wshadow -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -Wall -W -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTBUG-XXXXX-shadowTypedef -I. -I/qtbuild512/install/mac64/lib/QtWidgets.framework/Headers -I/qtbuild512/install/mac64/lib/QtGui.framework/Headers -I/qtbuild512/install/mac64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AGL.framework/Headers -I/qtbuild512/install/mac64/mkspecs/macx-clang -F/qtbuild512/install/mac64/lib -o main.o ../QTBUG-XXXXX-shadowTypedef/main.cpp In file included from ../QTBUG-XXXXX-shadowTypedef/main.cpp:2: In file included from /qtbuild512/install/mac64/lib/QtGui.framework/Headers/QtGui:3: In file included from /qtbuild512/install/mac64/lib/QtGui.framework/Headers/QtGuiDepends:3: In file included from /qtbuild512/install/mac64/lib/QtCore.framework/Headers/QtCore:40: /qtbuild512/install/mac64/lib/QtCore.framework/Headers/qcborstream.h:245:15: warning: declaration shadows a typedef in the global namespace [-Wshadow] using UInt = typename QIntegerForSizeof<FP>::Unsigned; ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libkern/OSTypes.h:36:26: note: previous declaration is here typedef unsigned int UInt; ^ 1 warning generated.
The warning goes away if I remove the include statement for ApplicationServices.h. In our application, this is in a precompiled header file along with <QtGui> and I'm wary of moving those around.
Attachments
For Gerrit Dashboard: QTBUG-75825 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
261864,5 | Work around Apple Clang's -Wshadow warning | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |
266573,2 | Work around Apple Clang's -Wshadow warning | 5.13 | qt/qtbase | Status: MERGED | +2 | 0 |