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

openmc-dev / openmc / 13546000884

26 Feb 2025 02:19PM UTC coverage: 85.015% (-0.2%) from 85.186%
13546000884

Pull #3328

github

web-flow
Merge 67a173195 into e060534ff
Pull Request #3328: NCrystal becomes runtime rather than buildtime dependency

81 of 108 new or added lines in 6 files covered. (75.0%)

467 existing lines in 21 files now uncovered.

51062 of 60062 relevant lines covered (85.02%)

32488887.43 hits per line

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

33.33
/include/openmc/error.h
1
#ifndef OPENMC_ERROR_H
2
#define OPENMC_ERROR_H
3

4
#include <cstring>
5
#include <sstream>
6
#include <string>
7

8
#include <fmt/format.h>
9

10
#include "openmc/capi.h"
11
#include "openmc/settings.h"
12

13
#if defined(__GNUC__) || defined(__clang__)
14
#define UNREACHABLE() __builtin_unreachable()
15
#else
16
#define UNREACHABLE() (void)0
17
#endif
18

19
namespace openmc {
20

21
inline void set_errmsg(const char* message)
22
{
23
  std::strcpy(openmc_err_msg, message);
×
24
}
25

26
inline void set_errmsg(const std::string& message)
27
{
28
  std::strcpy(openmc_err_msg, message.c_str());
29
}
30

31
inline void set_errmsg(const std::stringstream& message)
32
{
33
  std::strcpy(openmc_err_msg, message.str().c_str());
34
}
35

36
[[noreturn]] void fatal_error(const std::string& message, int err = -1);
37

38
[[noreturn]] inline void fatal_error(const std::stringstream& message)
39
{
40
  fatal_error(message.str());
41
}
42

43
[[noreturn]] inline void fatal_error(const char* message)
88✔
44
{
45
  fatal_error(std::string {message, std::strlen(message)});
88✔
46
}
47

48
void warning(const std::string& message);
49

50
inline void warning(const std::stringstream& message)
51
{
52
  warning(message.str());
53
}
54

55
void write_message(const std::string& message, int level = 0);
56

57
inline void write_message(const std::stringstream& message, int level)
58
{
59
  write_message(message.str(), level);
60
}
61

62
template<typename... Params>
UNCOV
63
void write_message(
×
64
  int level, const std::string& message, const Params&... fmt_args)
65
{
UNCOV
66
  if (settings::verbosity >= level) {
×
UNCOV
67
    write_message(fmt::format(message, fmt_args...));
×
68
  }
69
}
70

71
template<typename... Params>
72
void write_message(const std::string& message, const Params&... fmt_args)
73
{
74
  write_message(fmt::format(message, fmt_args...));
75
}
76

77
#ifdef OPENMC_MPI
78
extern "C" void abort_mpi(int code);
79
#endif
80

81
} // namespace openmc
82
#endif // OPENMC_ERROR_H
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