diff options
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r-- | src/corelib/global/qcompilerdetection.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 898abb12e8..5a19a20367 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -48,6 +48,7 @@ /* The compiler, must be one of: (Q_CC_x) + COVERITY - Coverity cov-scan SYM - Digital Mars C/C++ (used to be Symantec C++) MSVC - Microsoft Visual C/C++, Intel C++ for Windows BOR - Borland/Turbo C++ @@ -74,6 +75,10 @@ Should be sorted most to least authoritative. */ +#if defined(__COVERITY__) +# define Q_CC_COVERITY +#endif + /* Symantec C++ is now Digital Mars */ #if defined(__DMC__) || defined(__SC__) # define Q_CC_SYM @@ -1255,6 +1260,26 @@ #endif /* + * If one wants to add functions that use post-C++17 APIs, one needs to: + * + * 1) make them fully inline; and + * 2) guard them using the necessary feature-testing macros. + * + * This decouples the C++ version used to build Qt with the one used by + * end-user applications; Qt and the application can either choose any C++ + * version. + * + * A problem arises on MSVC for member functions of exported classes. Client + * code that tries to use such a function will see it as exported, and simply + * try to consume the function's *symbol*. However, if Qt has been built in + * C++17, it won't have such a symbol, and linking will fail. + * + * The workaround: declare such functions as function templates. + * (Obviously a function template does not need this marker.) +*/ +#define QT_POST_CXX17_API_IN_EXPORTED_CLASS template <typename = void> + +/* * Warning/diagnostic handling */ |