diff options
author | Harald Fernengel <harald.fernengel@nokia.com> | 2011-11-11 11:21:52 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-11 12:24:48 +0100 |
commit | 6a25a86d375b03805686e82dbe9e9974f92bf5dd (patch) | |
tree | 7ec42355f5f9b917cb1bfe25ca4f0fb529c72365 | |
parent | 999196e3369417969d4a561710d68c8bb1786c47 (diff) |
Add a -force-asserts option to configure
We have the following scenario: Either you build a release package
without asserts, or a debug package with asserts. However, in embedded
development, we need asserts also in release packages. This flag allows
you to build a release package, but Q_ASSERTs still fire.
Change-Id: Icd1dd4dd63c3cafecf515b40741263d902ad42d1
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rwxr-xr-x | configure | 14 | ||||
-rw-r--r-- | mkspecs/features/qt.prf | 1 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 6 |
3 files changed, 17 insertions, 4 deletions
@@ -833,6 +833,7 @@ CFG_COREWLAN=auto CFG_ICD=auto CFG_NOPROCESS=no CFG_ICU=auto +CFG_FORCE_ASSERTS=no # initalize variables used for installation QT_INSTALL_PREFIX= @@ -1037,7 +1038,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-icu) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-v8|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-icu|-force-asserts) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -2403,6 +2404,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + force-asserts) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_FORCE_ASSERTS="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; *) UNKNOWN_OPT=yes ;; @@ -7251,6 +7259,10 @@ if [ "$CFG_ICU" = "yes" ]; then QT_CONFIG="$QT_CONFIG icu" fi +if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then + QT_CONFIG="$QT_CONFIG force_asserts" +fi + # # Some Qt modules are too advanced in C++ for some old compilers # Detect here the platforms where they are known to work. diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 39d7a4b8a8..d288930eaf 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -18,6 +18,7 @@ win32 { !isEmpty(QMAKESPEC_ORIGINAL):INCLUDEPATH += $$QMAKESPEC_ORIGINAL } CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG +contains(QT_CONFIG, force_asserts):DEFINES += QT_FORCE_ASSERTS no_keywords:DEFINES += QT_NO_KEYWORDS plugin { #Qt plugins static:DEFINES += QT_STATICPLUGIN diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 2b44d708ea..714e120db6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1706,10 +1706,10 @@ inline QNoDebug qDebug(); Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); #if !defined(Q_ASSERT) -# ifndef QT_NO_DEBUG -# define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) -# else +# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) # define Q_ASSERT(cond) qt_noop() +# else +# define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) # endif #endif |