Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does QT_NO_DEBUG cause a definition of NDEBUG?

I'm auditing some source code written with the Qt framework. A typical release build command line output includes QT_NO_DEBUG preprocessor macro, but does not include Posix's NDEBUG preprocessor macro. The Qt documentation on QT_NO_DEBUG does not discuss NDEBUG (I may not have found the correct documentation, btw).

Does Qt's QT_NO_DEBUG cause a definition of Posix's NDEBUG?

like image 578
jww Avatar asked Mar 27 '15 19:03

jww


1 Answers

No. Add

CONFIG(release, debug|release): DEFINES += NDEBUG

to your .pro file and a test like

{
    bool valuesEqual = false;

#ifdef NDEBUG
#ifdef QT_NO_DEBUG
    valuesEqual = true;
#endif
#endif

#ifndef NDEBUG
#ifndef QT_NO_DEBUG
    valuesEqual = true;
#endif
#endif

    EXPECT_TRUE(valuesEqual);
}
like image 150
Simon Warta Avatar answered Nov 17 '22 05:11

Simon Warta