Move the checks for disabling useless warnings to qcompilerdetection.h
Task-number: QTBUG-99313 Change-Id: I7b4a62e7a8f8a07a9386a6f1f41a33c3fc802daf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
180e55a586
commit
217a5f0745
@ -1282,6 +1282,37 @@ static_assert(!std::is_convertible_v<std::nullptr_t, bool>,
|
|||||||
# define Q_INLINE_TEMPLATE inline
|
# define Q_INLINE_TEMPLATE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Avoid some particularly useless warnings from some stupid compilers.
|
||||||
|
To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
|
||||||
|
the line "#define QT_NO_WARNINGS". See also QTBUG-26877.
|
||||||
|
*/
|
||||||
|
#if !defined(QT_CC_WARNINGS)
|
||||||
|
# define QT_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
#if defined(QT_NO_WARNINGS)
|
||||||
|
# if defined(Q_CC_MSVC)
|
||||||
|
QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
|
||||||
|
QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
|
||||||
|
# elif defined(Q_CC_BOR)
|
||||||
|
# pragma option -w-inl
|
||||||
|
# pragma option -w-aus
|
||||||
|
# pragma warn -inl
|
||||||
|
# pragma warn -pia
|
||||||
|
# pragma warn -ccc
|
||||||
|
# pragma warn -rch
|
||||||
|
# pragma warn -sig
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // QCOMPILERDETECTION_H
|
#endif // QCOMPILERDETECTION_H
|
||||||
|
@ -393,37 +393,6 @@ Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size
|
|||||||
Q_CORE_EXPORT void qFreeAligned(void *ptr);
|
Q_CORE_EXPORT void qFreeAligned(void *ptr);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Avoid some particularly useless warnings from some stupid compilers.
|
|
||||||
To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
|
|
||||||
the line "#define QT_NO_WARNINGS".
|
|
||||||
*/
|
|
||||||
#if !defined(QT_CC_WARNINGS)
|
|
||||||
# define QT_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
#if defined(QT_NO_WARNINGS)
|
|
||||||
# if defined(Q_CC_MSVC)
|
|
||||||
QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
|
|
||||||
QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
|
|
||||||
# elif defined(Q_CC_BOR)
|
|
||||||
# pragma option -w-inl
|
|
||||||
# pragma option -w-aus
|
|
||||||
# pragma warn -inl
|
|
||||||
# pragma warn -pia
|
|
||||||
# pragma warn -ccc
|
|
||||||
# pragma warn -rch
|
|
||||||
# pragma warn -sig
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// this adds const to non-const objects (like std::as_const)
|
// this adds const to non-const objects (like std::as_const)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
|
constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user