From ebef2ad1360c80ad62de5f4a1c4e7e4051725c1c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 10 Sep 2014 20:37:51 -0700 Subject: Make the empty Q_ASSERT still check its argument for validity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the side-effect that variables and functions in the argument are now "used". This means we don't need to #ifndef functions only used in assertions: the compiler will eliminate them by dead code elimination. Due to the mandatory short-circuiting of the condition, no functions will ever be called and this expands to no more code than before. On the negative side, because we won't get warnings for unused variables initialized outside the Q_ASSERT, non-inlineable calls will not be elminated by dead code elimination, so they will remain in release code without warnings. Because of the expanded code now in Q_ASSERT, the Intel compiler's optimizer gets thrown: it complains that the non-void function is failing to return anything, so I had to add two return statements. Change-Id: I1bb79c9637a2771ef1ec093f901b8d2443788bd6 Reviewed-by: Marc Mutz Reviewed-by: Jędrzej Nowacki --- src/corelib/io/qtemporaryfile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/io/qtemporaryfile.cpp') diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 4a9aafcf0b..c96d0504f4 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -222,6 +222,7 @@ static bool createFileFromTemplate(NativeFileHandle &file, } Q_ASSERT(false); + return false; } //************* QTemporaryFileEngine -- cgit v1.2.3