1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released      *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission.     *
5  ******************************************************************************************************/
6 
7 #ifndef ENGAUGE_ASSERT_H
8 #define ENGAUGE_ASSERT_H
9 
10 #include "LoggerUpload.h"
11 #include <QtGlobal>
12 
13 // For the replacements below, the qt_noop part prevents 'missing return' compiler warnings at the ends of functions
engauge_noop(bool)14 inline void engauge_noop(bool) {}
15 
16 /// Drop in replacement for Q_ASSERT
17 #define ENGAUGE_ASSERT(cond) ((!(cond)) ? LoggerUpload::loggerAssert(#cond,__FILE__,__LINE__) : engauge_noop(cond))
18 
19 /// Drop in replacement for Q_CHECK_PTR
20 #define ENGAUGE_CHECK_PTR(ptr) (((ptr)==nullptr) ? LoggerUpload::loggerCheckPtr(#ptr,__FILE__,__LINE__) : engauge_noop((ptr)==nullptr))
21 
22 #endif // ENGAUGE_ASSERT_H
23