Make it an error to omit __builtin_available where needed

This guarantees that we have proper version checks in place for APIs on
Apple platforms that are not necessarily available on the deployment
target.

Change-Id: I10060f8b910f2bb790aa4a9c6f8c5cdc14d7cf06
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jake Petroules 2017-09-22 00:42:38 -07:00
parent 7fd3cc3980
commit 1e1de2b2e1

View File

@ -58,6 +58,15 @@ clang {
clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} clang_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
versionAtLeast(clang_ver, 3.5): \ versionAtLeast(clang_ver, 3.5): \
QMAKE_CXXFLAGS_WARN_ON += -Wdate-time QMAKE_CXXFLAGS_WARN_ON += -Wdate-time
# Clang/LLVM 5.0 and Xcode 9.0 introduced unguarded availability warnings.
# The same construct has been a hard error in Swift from the very beginning.
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
darwin:if(versionAtLeast(clang_ver, 5.0)|versionAtLeast(apple_ver, 9.0)): \
QMAKE_CXXFLAGS_WARN_ON += \
-Werror=unguarded-availability \
-Werror=unguarded-availability-new \
-Werror=unsupported-availability-guard
} else: gcc:!intel_icc { } else: gcc:!intel_icc {
QMAKE_CXXFLAGS_WARN_ON += -Wvla QMAKE_CXXFLAGS_WARN_ON += -Wvla
# GCC 5 introduced -Wdate-time # GCC 5 introduced -Wdate-time