Only define CALLBACK when PCH is used

The PCH header is undefining CALLBACK after loading Windows headers,
but we need to add it back when using Windows headers that need it.

The new definition needs only to be done when the PCH is used,
otherwise it could lead to re-definition warnings.

Amends 7880950eca

Change-Id: Iae57ac4bbbfdd45b5f9b50a2242103bec6eea5bc
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Cristian Adam
2021-05-05 10:28:07 +02:00
parent 3c45f9f23d
commit de9be2bb9d
6 changed files with 18 additions and 1 deletions

View File

@@ -44,7 +44,9 @@
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#ifdef QTCREATOR_PCH_H
#define CALLBACK WINAPI #define CALLBACK WINAPI
#endif
#include <qt_windows.h> #include <qt_windows.h>
#include <shlobj.h> #include <shlobj.h>
#endif #endif

View File

@@ -46,7 +46,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#ifndef CALLBACK #ifdef QTCREATOR_PCH_H
#define CALLBACK WINAPI #define CALLBACK WINAPI
#endif #endif

View File

@@ -50,7 +50,9 @@
#include <memory> #include <memory>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#ifdef QTCREATOR_PCH_H
#define CALLBACK WINAPI #define CALLBACK WINAPI
#endif
#include <qt_windows.h> #include <qt_windows.h>
#else #else
#include <errno.h> #include <errno.h>

View File

@@ -31,7 +31,9 @@
#include <QDir> #include <QDir>
#include <QString> #include <QString>
#ifdef QTCREATOR_PCH_H
#define CALLBACK WINAPI #define CALLBACK WINAPI
#endif
#include <windows.h> #include <windows.h>
#include <objbase.h> #include <objbase.h>
#include <shellapi.h> #include <shellapi.h>

View File

@@ -27,6 +27,8 @@
* This is a precompiled header file for use in Xcode / Mac GCC / * This is a precompiled header file for use in Xcode / Mac GCC /
* GCC >= 3.4 / VC to greatly speed the building of Qt Creator. * GCC >= 3.4 / VC to greatly speed the building of Qt Creator.
*/ */
#ifndef QTCREATOR_GUI_PCH_H
#define QTCREATOR_GUI_PCH_H
#include "qtcreator_pch.h" #include "qtcreator_pch.h"
@@ -45,3 +47,5 @@
#include <QWidget> #include <QWidget>
#endif #endif
#endif // QTCREATOR_GUI_PCH_H

View File

@@ -26,8 +26,13 @@
/* /*
* This is a precompiled header file for use in Xcode / Mac GCC / * This is a precompiled header file for use in Xcode / Mac GCC /
* GCC >= 3.4 / VC to greatly speed the building of Qt Creator. * GCC >= 3.4 / VC to greatly speed the building of Qt Creator.
*
* The define below is checked in source code. Do not replace with #pragma once!
*/ */
#ifndef QTCREATOR_PCH_H
#define QTCREATOR_PCH_H
#if defined __cplusplus #if defined __cplusplus
#include <QtGlobal> #include <QtGlobal>
@@ -85,3 +90,5 @@ using Qt::noforcesign;
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#endif // QTCREATOR_PCH_H