Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
#pragma once

#include "absl/base/macros.h"

// NOLINT(namespace-envoy)

// This file is part of the QUICHE platform implementation, and is not to be
// consumed or referenced directly by other Envoy code. It serves purely as a
// porting layer for QUICHE.

#include <utility>

#include "extensions/quic_listeners/quiche/platform/quic_logging_impl.h"

#include "absl/base/macros.h"

#define HTTP2_FALLTHROUGH_IMPL ABSL_FALLTHROUGH_INTENDED
#define HTTP2_DIE_IF_NULL_IMPL(ptr) ABSL_DIE_IF_NULL(ptr)
#define HTTP2_DIE_IF_NULL_IMPL(ptr) dieIfNull(ptr)
#define HTTP2_UNREACHABLE_IMPL() DCHECK(false)

namespace http2 {

template <typename T> inline T dieIfNull(T&& ptr) {
CHECK((ptr) != nullptr);
return std::forward<T>(ptr);
}

// TODO: implement
#define HTTP2_UNREACHABLE_IMPL() 0
} // namespace http2
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// NOLINT(namespace-envoy)

// This file is part of the QUICHE platform implementation, and is not to be
// consumed or referenced directly by other Envoy code. It serves purely as a
// porting layer for QUICHE.

#include <memory>

#include "test/test_common/logging.h"
Expand All @@ -8,6 +14,7 @@
#include "quiche/http2/platform/api/http2_containers.h"
#include "quiche/http2/platform/api/http2_estimate_memory_usage.h"
#include "quiche/http2/platform/api/http2_logging.h"
#include "quiche/http2/platform/api/http2_macros.h"
#include "quiche/http2/platform/api/http2_optional.h"
#include "quiche/http2/platform/api/http2_ptr_util.h"
#include "quiche/http2/platform/api/http2_string.h"
Expand All @@ -19,10 +26,7 @@
// minimal, and serve primarily to verify the APIs compile and link without
// issue.

namespace Envoy {
namespace Extensions {
namespace QuicListeners {
namespace Quiche {
namespace http2 {
namespace {

TEST(Http2PlatformTest, Http2Arraysize) {
Expand Down Expand Up @@ -96,8 +100,10 @@ TEST(Http2PlatformTest, Http2StringPiece) {
EXPECT_EQ('b', sp[0]);
}

TEST(Http2PlatformTest, Http2Macro) {
EXPECT_DEBUG_DEATH(HTTP2_UNREACHABLE(), "");
EXPECT_DEATH(HTTP2_DIE_IF_NULL(nullptr), "");
}

} // namespace
} // namespace Quiche
} // namespace QuicListeners
} // namespace Extensions
} // namespace Envoy
} // namespace http2