GCC Code Coverage Report


Directory: libs/beast2/
File: src/error.cpp
Date: 2025-11-13 15:50:44
Exec Total Coverage
Lines: 0 9 0.0%
Functions: 0 3 0.0%
Branches: 0 4 0.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/cppalliance/beast2
8 //
9
10 #include <boost/beast2/error.hpp>
11 #include <boost/assert.hpp>
12 #include <cstring>
13
14 namespace boost {
15 namespace beast2 {
16
17 namespace detail {
18
19 const char*
20 error_cat_type::
21 name() const noexcept
22 {
23 return "boost.beast2";
24 }
25
26 std::string
27 error_cat_type::
28 message(int code) const
29 {
30 return message(code, nullptr, 0);
31 }
32
33 char const*
34 error_cat_type::
35 message(
36 int code,
37 char*,
38 std::size_t) const noexcept
39 {
40 switch(static_cast<error>(code))
41 {
42 case error::success: return "http_proto::error::success";
43 default:
44 return "http_proto::error::?";
45 }
46 }
47
48 //-----------------------------------------------
49
50 // msvc 14.0 has a bug that warns about inability
51 // to use constexpr construction here, even though
52 // there's no constexpr construction
53 #if defined(_MSC_VER) && _MSC_VER <= 1900
54 # pragma warning( push )
55 # pragma warning( disable : 4592 )
56 #endif
57
58 #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
59 constinit error_cat_type error_cat;
60 #else
61 error_cat_type error_cat;
62 #endif
63
64 #if defined(_MSC_VER) && _MSC_VER <= 1900
65 # pragma warning( pop )
66 #endif
67
68 } // detail
69
70 } // beast2
71 } // boost
72