1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// *****************************************************************************
/*!
  \file      src/UnitTest/QuietCerr.cpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.,
             2022-2025 J. Bakosi
             All rights reserved. See the LICENSE file for details.
  \brief     Charm++ nodegroup to quiet std::cerr in a thread-safe fashion
  \details   Charm++ nodegroup to quiet std::cerr in a thread-safe fashion.
*/
// *****************************************************************************

#include <iostream><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <sstream><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "QuietCerr.hpp"

namespace tk {

#if defined(__clang__)
  #pragma clang diagnostic push
  #pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif

//! std::tringstream used to quiet std::cerr's stream by redirecting to it
static std::stringstream cerr_quiet;
//! std::streambuf used to store state of std::cerr before redirecting it
static std::streambuf* cerr_old;

#if defined(__clang__)
  #pragma clang diagnostic pop
#endif

}

using tk::QuietCerr;

void
// cppcheck-suppress unusedFunction
QuietCerr::quiet()
// *****************************************************************************
//!   Section "Initializations at Program Startup" at in the Charm++ manual
//!   http://charm.cs.illinois.edu/manuals/html/charm++/manual.html. Since it
//!   is executed once every logical node, it is thread-safe.
// *****************************************************************************
{
  tk::cerr_old = std::cerr.rdbuf( tk::cerr_quiet.rdbuf() );
}

QuietCerr::~QuietCerr()
// *****************************************************************************
// Destructor: restore std::cerr's stream state
// *****************************************************************************
{
  std::cerr.rdbuf( tk::cerr_old );
}

#include "NoWarning/quietcerr.def.h"<--- Include file: "NoWarning/quietcerr.def.h" not found.