OpenVPN 3 Core Library
Loading...
Searching...
No Matches
unreachable.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2024- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12
13#pragma once
14
15namespace openvpn {
16
17// Replace std::unreachable, only available in C++23
18// Based on https://en.cppreference.com/w/cpp/utility/unreachable
19[[noreturn]] inline void unreachable()
20{
21 // Uses compiler specific extensions if possible.
22 // Even if no extension is used, undefined behavior is still raised by
23 // an empty function body and the noreturn attribute.
24#if defined(__GNUC__)
25 __builtin_unreachable();
26#elif defined(_MSC_VER)
27 __assume(false);
28#endif
29}
30
31} // namespace openvpn
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
void unreachable()