[c++14] Remove C++11 compatibility macros (#30296)

pull/30265/head^2
Craig Tiller 2 years ago committed by GitHub
parent 67be31c38c
commit cb4c468910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  2. 18
      src/core/lib/surface/validate_metadata.cc

@ -59,14 +59,6 @@
// IWYU pragma: no_include <type_traits>
#if __cplusplus > 201103L
#define GRPC_HPACK_CONSTEXPR_FN constexpr
#define GRPC_HPACK_CONSTEXPR_VALUE constexpr
#else
#define GRPC_HPACK_CONSTEXPR_FN
#define GRPC_HPACK_CONSTEXPR_VALUE const
#endif
namespace grpc_core {
TraceFlag grpc_trace_chttp2_hpack_parser(false, "chttp2_hpack_parser");
@ -454,7 +446,7 @@ constexpr char kBase64Alphabet[] =
// any complicated runtime logic.
struct Base64InverseTable {
uint8_t table[256]{};
GRPC_HPACK_CONSTEXPR_FN Base64InverseTable() {
constexpr Base64InverseTable() {
for (int i = 0; i < 256; i++) {
table[i] = 255;
}
@ -466,7 +458,7 @@ struct Base64InverseTable {
}
};
GRPC_HPACK_CONSTEXPR_VALUE Base64InverseTable kBase64InverseTable;
constexpr Base64InverseTable kBase64InverseTable;
} // namespace
// Input tracks the current byte through the input data and provides it

@ -29,14 +29,6 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
#if __cplusplus > 201103l
#define GRPC_VALIDATE_METADATA_CONSTEXPR_FN constexpr
#define GRPC_VALIDATE_METADATA_CONSTEXPR_VALUE constexpr
#else
#define GRPC_VALIDATE_METADATA_CONSTEXPR_FN
#define GRPC_VALIDATE_METADATA_CONSTEXPR_VALUE const
#endif
static grpc_error_handle conforms_to(const grpc_slice& slice,
const grpc_core::BitSet<256>& legal_bits,
const char* err_desc) {
@ -68,7 +60,7 @@ static int error2int(grpc_error_handle error) {
namespace {
class LegalHeaderKeyBits : public grpc_core::BitSet<256> {
public:
GRPC_VALIDATE_METADATA_CONSTEXPR_FN LegalHeaderKeyBits() {
constexpr LegalHeaderKeyBits() {
for (int i = 'a'; i <= 'z'; i++) set(i);
for (int i = '0'; i <= '9'; i++) set(i);
set('-');
@ -76,8 +68,7 @@ class LegalHeaderKeyBits : public grpc_core::BitSet<256> {
set('.');
}
};
GRPC_VALIDATE_METADATA_CONSTEXPR_VALUE LegalHeaderKeyBits
g_legal_header_key_bits;
constexpr LegalHeaderKeyBits g_legal_header_key_bits;
} // namespace
grpc_error_handle grpc_validate_header_key_is_legal(const grpc_slice& slice) {
@ -103,14 +94,13 @@ int grpc_header_key_is_legal(grpc_slice slice) {
namespace {
class LegalHeaderNonBinValueBits : public grpc_core::BitSet<256> {
public:
GRPC_VALIDATE_METADATA_CONSTEXPR_FN LegalHeaderNonBinValueBits() {
constexpr LegalHeaderNonBinValueBits() {
for (int i = 32; i <= 126; i++) {
set(i);
}
}
};
GRPC_VALIDATE_METADATA_CONSTEXPR_VALUE LegalHeaderNonBinValueBits
g_legal_header_non_bin_value_bits;
constexpr LegalHeaderNonBinValueBits g_legal_header_non_bin_value_bits;
} // namespace
grpc_error_handle grpc_validate_header_nonbin_value_is_legal(

Loading…
Cancel
Save