From cb4c4689105a65e9653a1b9cf231570b9c3a663b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 14 Jul 2022 14:18:29 -0700 Subject: [PATCH] [c++14] Remove C++11 compatibility macros (#30296) --- .../transport/chttp2/transport/hpack_parser.cc | 12 ++---------- src/core/lib/surface/validate_metadata.cc | 18 ++++-------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 5354338cba3..acc7ed96e64 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -59,14 +59,6 @@ // IWYU pragma: no_include -#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 diff --git a/src/core/lib/surface/validate_metadata.cc b/src/core/lib/surface/validate_metadata.cc index a093324d15d..938f25e82d5 100644 --- a/src/core/lib/surface/validate_metadata.cc +++ b/src/core/lib/surface/validate_metadata.cc @@ -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(