minor fixes for style

This commit is contained in:
Guenter Obiltschnig 2016-09-14 17:06:55 +02:00
parent f0402f2773
commit dcdcee5afa

View File

@ -22,6 +22,7 @@
#include "Poco/Foundation.h"
#include <string>
#include <cstdlib>
#if defined(_DEBUG)
# include <iostream>
#endif
@ -83,23 +84,26 @@ protected:
//
#if defined(__KLOCWORK__) || defined(__clang_analyzer__)
// Short-circuit these macros when under static analysis.
// Ideally, static analysis tools should understand and reason correctly about
// noreturn methods such as Bugcheck::bugcheck. In practice, they don't.
// Help them by turning these macros into 'abort' as described here:
// noreturn methods such as Bugcheck::bugcheck(). In practice, they don't.
// Help them by turning these macros into std::abort() as described here:
// https://developer.klocwork.com/documentation/en/insight/10-1/tuning-cc-analysis#Usingthe__KLOCWORK__macro
#include <cstdlib> // for abort
#define poco_assert_dbg(cond) do { if (!(cond)) abort(); } while (0)
#define poco_assert_msg_dbg(cond, text) do { if (!(cond)) abort(); } while (0)
#define poco_assert(cond) do { if (!(cond)) abort(); } while (0)
#define poco_assert_msg(cond, text) do { if (!(cond)) abort(); } while (0)
#define poco_check_ptr(ptr) do { if (!(ptr)) abort(); } while (0)
#define poco_bugcheck() do { abort(); } while (0)
#define poco_bugcheck_msg(msg) do { abort(); } while (0)
#define poco_assert_dbg(cond) do { if (!(cond)) std::abort(); } while (0)
#define poco_assert_msg_dbg(cond, text) do { if (!(cond)) std::abort(); } while (0)
#define poco_assert(cond) do { if (!(cond)) std::abort(); } while (0)
#define poco_assert_msg(cond, text) do { if (!(cond)) std::abort(); } while (0)
#define poco_check_ptr(ptr) do { if (!(ptr)) std::abort(); } while (0)
#define poco_bugcheck() do { std::abort(); } while (0)
#define poco_bugcheck_msg(msg) do { std::abort(); } while (0)
#else // defined(__KLOCWORK__) || defined(__clang_analyzer__)
#if defined(_DEBUG)
#define poco_assert_dbg(cond) \
if (!(cond)) Poco::Bugcheck::assertion(#cond, __FILE__, __LINE__); else (void) 0
@ -131,8 +135,10 @@ protected:
#define poco_bugcheck_msg(msg) \
Poco::Bugcheck::bugcheck(msg, __FILE__, __LINE__)
#endif // defined(__KLOCWORK__) || defined(__clang_analyzer__)
#define poco_unexpected() \
Poco::Bugcheck::unexpected(__FILE__, __LINE__);