aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
diff options
context:
space:
mode:
authorSimo Fält <simo.falt@qt.io>2023-06-29 15:19:20 +0300
committerSimo Fält <simo.falt@qt.io>2023-06-29 15:19:20 +0300
commit568797c36a73aecce050fd198353f31aa986bff9 (patch)
treee1781afe922c4b6327045134639a5c5d41b56300 /sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
parent643237181d15086816d38cdb17f18147c7ebcbd8 (diff)
parentc76c68a64bb4dce48017c61b4ca021dc6726f77b (diff)
Merge tag 'v5.15.11-lts' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Qt For Python Release 5.15.11 Change-Id: Idbf9b792238244e185e39be4058a7a2c69458ce9
Diffstat (limited to 'sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index b73670909..ebe3b995a 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -784,18 +784,22 @@ static bool cStringStartsWith(const char *str, const QByteArray &prefix)
return std::strncmp(prefix.constData(), str, int(prefix.size())) == 0;
}
+#ifdef Q_OS_UNIX
+static bool cStringContains(const char *str, const char *prefix)
+{
+ return std::strstr(str, prefix) != nullptr;
+}
+#endif
+
bool BuilderPrivate::visitHeader(const char *cFileName) const
{
// Resolve OpenGL typedefs although the header is considered a system header.
const char *baseName = cBaseName(cFileName);
if (cCompareFileName(baseName, "gl.h"))
return true;
-#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
- if (cStringStartsWith(cFileName, "/usr/include/stdint.h"))
- return true;
-#endif
#ifdef Q_OS_LINUX
- if (cStringStartsWith(cFileName, "/usr/include/stdlib.h")
+ if (cStringStartsWith(cFileName, "/usr/include/stdint.h")
+ || cStringStartsWith(cFileName, "/usr/include/stdlib.h")
|| cStringStartsWith(cFileName, "/usr/include/sys/types.h")) {
return true;
}
@@ -804,9 +808,9 @@ bool BuilderPrivate::visitHeader(const char *cFileName) const
// Parse the following system headers to get the correct typdefs for types like
// int32_t, which are used in the macOS implementation of OpenGL framework.
if (cCompareFileName(baseName, "gltypes.h")
- || cStringStartsWith(cFileName, "/usr/include/_types")
- || cStringStartsWith(cFileName, "/usr/include/_types")
- || cStringStartsWith(cFileName, "/usr/include/sys/_types")) {
+ || cStringContains(cFileName, "/usr/include/stdint.h")
+ || cStringContains(cFileName, "/usr/include/_types")
+ || cStringContains(cFileName, "/usr/include/sys/_types")) {
return true;
}
#endif // Q_OS_MACOS