• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 21108840797

18 Jan 2026 08:35AM UTC coverage: 60.508% (+0.02%) from 60.492%
21108840797

push

github

web-flow
ClangTidy readability-else-after-return (#857)

* trigger tidy

* Automated clang-tidy change: readability-else-after-return

* compile test

* rerun

* Automated clang-tidy change: readability-else-after-return

* trigger..

* Automated clang-tidy change: readability-else-after-return

* manually removed a few

* Automated clang-tidy change: readability-else-after-return

* removed duplicate code

* fix remaining warnings

* fixed scope

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>

837 of 1874 new or added lines in 151 files covered. (44.66%)

46 existing lines in 25 files now uncovered.

44448 of 73458 relevant lines covered (60.51%)

525066.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pol-core/clib/passert.cpp
1
/** @file
2
 *
3
 * @par History
4
 * - 2005/01/17 Shinigami: passert_failed extended by param "reason" (see passert*_r macros)
5
 * - 2005/09/16 Shinigami: scripts_thread_script* moved to passert
6
 * - 2006/11/26 Shinigami: fixed a crash in passert_failed
7
 */
8

9

10
#include "passert.h"
11

12
#include "Debugging/ExceptionParser.h"
13
#include "esignal.h"
14
#include "logfacility.h"
15
#include "stlutil.h"
16
#include "strutil.h"
17

18
#ifdef WINDOWS
19
#include "Header_Windows.h"
20
#include "mdumpimp.h"
21
#else
22
#include <cstdlib>
23
#endif
24

25

26
namespace Pol::Clib
27
{
28
bool passert_dump_stack = false;
29
bool passert_shutdown = false;
30
bool passert_abort = true;
31
bool passert_nosave = false;
32
bool passert_shutdown_due_to_assertion = false;
33

34
std::string scripts_thread_script;
35
unsigned scripts_thread_scriptPC;
36

37
#ifdef _WIN32
38
void force_backtrace( bool /*complete*/ )
39
{
40
  __try
41
  {
42
    int* p = 0;
43
    *p = 7;  // dump the stack
44
  }
45
  __except ( ( HiddenMiniDumper::TopLevelFilter( GetExceptionInformation() ) ),
46
             EXCEPTION_EXECUTE_HANDLER )
47
  {
48
  }
49
}
50
#else
51
void force_backtrace( bool complete )
×
52
{
53
  std::string stack_trace = Clib::ExceptionParser::getTrace();
×
54
  POLLOG_ERRORLN( "=== Stack Backtrace ===\n{}", stack_trace );
×
55
  if ( complete )
×
56
    ExceptionParser::logAllStackTraces();
×
57
}
×
58
#endif
59

60
void passert_failed( const char* expr, const char* file, unsigned line )
×
61
{
62
  passert_failed( expr, "", file, line );
×
63
}
64

65
void passert_failed( const char* expr, const std::string& reason, const char* file, unsigned line )
×
66
{
67
  if ( !reason.empty() )
×
68
    POLLOG_ERRORLN( "Assertion Failed: {} ({}), {}, line {}", expr, reason, file, line );
×
69
  else
70
    POLLOG_ERRORLN( "Assertion Failed: {}, {}, line {}", expr, file, line );
×
71

72
  if ( passert_dump_stack )
×
73
  {
74
    POLLOG_ERRORLN( "Forcing stack backtrace." );
×
75
    force_backtrace();
×
76
  }
77
  else
78
  {
79
#ifdef _WIN32
80
    HiddenMiniDumper::print_backtrace();
81
#endif
82
  }
83

84
  /**
85
   * use the program abort reporting system
86
   */
87
  if ( Pol::Clib::ExceptionParser::programAbortReporting() )
×
88
  {
89
    char reportedReason[512];
90
    if ( snprintf( reportedReason, arsize( reportedReason ),
×
91
                   "ASSERT(%s, reason: \"%s\") failed in %s:%d", expr, reason.c_str(), file,
92
                   line ) > 0 )
×
93
      ExceptionParser::reportProgramAbort( ExceptionParser::getTrace(),
×
94
                                           std::string( reportedReason ) );
×
95
    else
96
      ExceptionParser::reportProgramAbort( ExceptionParser::getTrace(), "ASSERT failed" );
×
97
  }
98

99

100
  if ( passert_shutdown )
×
101
  {
102
    POLLOG_ERRORLN( "Shutting down due to assertion failure." );
×
103
    Clib::signal_exit( 1 );
×
104
    passert_shutdown_due_to_assertion = true;
×
105
  }
106
  if ( passert_abort )
×
107
  {
108
    POLLOG_ERRORLN( "Aborting due to assertion failure." );
×
109
    Logging::global_logger->wait_for_empty_queue();
×
110
    abort();
×
111
  }
112

113
  if ( !reason.empty() )
×
114
  {
115
    throw std::runtime_error( "Assertion Failed: " + std::string( expr ) + " (" +
×
116
                              std::string( reason ) + "), " + std::string( file ) + ", line " +
×
117
                              tostring( line ) );
×
118
  }
119

NEW
120
  throw std::runtime_error( "Assertion Failed: " + std::string( expr ) + ", " +
×
NEW
121
                            std::string( file ) + ", line " + tostring( line ) );
×
122
}
123
}  // namespace Pol::Clib
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc