From 183952b11de8854b1f11c7534eab78d23e1e6ff6 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Mon, 29 Apr 2024 23:09:30 +0800 Subject: [PATCH] Restrict BRPC_VALIDATE_GFLAG to global scope and namespace scope only --- src/brpc/reloadable_flags.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/brpc/reloadable_flags.h b/src/brpc/reloadable_flags.h index bbe62f8927..c451bde850 100644 --- a/src/brpc/reloadable_flags.h +++ b/src/brpc/reloadable_flags.h @@ -35,9 +35,10 @@ // modify directly. To emphasize this, you have to write the validator by // yourself and use GFLAGS_NS::GetCommandLineOption() to acess the flag. #define BRPC_VALIDATE_GFLAG(flag, validate_fn) \ - const int register_FLAGS_ ## flag ## _dummy \ - __attribute__((__unused__)) = \ - ::brpc::RegisterFlagValidatorOrDie( \ + namespace brpc_flags {} \ + const int register_FLAGS_ ## flag ## _dummy \ + __attribute__((__unused__)) = \ + ::brpc::RegisterFlagValidatorOrDie( \ &FLAGS_##flag, (validate_fn))