Reland "Prefix flag macros with WEBRTC_."
This is a reland of 5ccdc1331fcc3cd78eaa14408fe0c38d37a5a51d Original change's description: > Prefix flag macros with WEBRTC_. > > Macros defined in rtc_base/flags.h are intended to be used to define > flags in WebRTC's binaries (e.g. tests). > > They are currently not prefixed and this could cause problems with > downstream clients since these names are quite common. > > This CL adds the 'WEBRTC_' prefix to them. > > Generated with: > > for x in DECLARE DEFINE; do > for y in bool int float string FLAG; do > git grep -l "\b$x\_$y\b" | \ > xargs sed -i "s/\b$x\_$y\b/WEBRTC_$x\_$y/g" > done > done > git cl format > > Bug: webrtc:9884 > Change-Id: I7b524762b6a3e5aa5b2fc2395edd3e1a0fe72591 > Reviewed-on: https://webrtc-review.googlesource.com/c/106682 > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#25270} TBR=kwiberg@webrtc.org Bug: webrtc:9884 Change-Id: I5ba5368a231a334d135ed5e6fd7a279629ced8a3 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://webrtc-review.googlesource.com/c/107161 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25277}
This commit is contained in:
committed by
Commit Bot
parent
c538fc77b0
commit
2dfa998be2
@ -36,7 +36,7 @@ union FlagValue {
|
||||
// bool values ('bool b = "false";' results in b == true!), we pass
|
||||
// and int argument to New_BOOL as this appears to be safer - sigh.
|
||||
// In particular, it prevents the (not uncommon!) bug where a bool
|
||||
// flag is defined via: DEFINE_bool(flag, "false", "some comment");.
|
||||
// flag is defined via: WEBRTC_DEFINE_bool(flag, "false", "some comment");.
|
||||
static FlagValue New_BOOL(int b) {
|
||||
FlagValue v;
|
||||
v.b = (b != 0);
|
||||
@ -155,7 +155,7 @@ class Flag {
|
||||
};
|
||||
|
||||
// Internal use only.
|
||||
#define DEFINE_FLAG(type, c_type, name, default, comment) \
|
||||
#define WEBRTC_DEFINE_FLAG(type, c_type, name, default, comment) \
|
||||
/* define and initialize the flag */ \
|
||||
c_type FLAG_##name = (default); \
|
||||
/* register the flag */ \
|
||||
@ -164,25 +164,25 @@ class Flag {
|
||||
rtc::FlagValue::New_##type(default))
|
||||
|
||||
// Internal use only.
|
||||
#define DECLARE_FLAG(c_type, name) \
|
||||
/* declare the external flag */ \
|
||||
#define WEBRTC_DECLARE_FLAG(c_type, name) \
|
||||
/* declare the external flag */ \
|
||||
extern c_type FLAG_##name
|
||||
|
||||
// Use the following macros to define a new flag:
|
||||
#define DEFINE_bool(name, default, comment) \
|
||||
DEFINE_FLAG(BOOL, bool, name, default, comment)
|
||||
#define DEFINE_int(name, default, comment) \
|
||||
DEFINE_FLAG(INT, int, name, default, comment)
|
||||
#define DEFINE_float(name, default, comment) \
|
||||
DEFINE_FLAG(FLOAT, double, name, default, comment)
|
||||
#define DEFINE_string(name, default, comment) \
|
||||
DEFINE_FLAG(STRING, const char*, name, default, comment)
|
||||
#define WEBRTC_DEFINE_bool(name, default, comment) \
|
||||
WEBRTC_DEFINE_FLAG(BOOL, bool, name, default, comment)
|
||||
#define WEBRTC_DEFINE_int(name, default, comment) \
|
||||
WEBRTC_DEFINE_FLAG(INT, int, name, default, comment)
|
||||
#define WEBRTC_DEFINE_float(name, default, comment) \
|
||||
WEBRTC_DEFINE_FLAG(FLOAT, double, name, default, comment)
|
||||
#define WEBRTC_DEFINE_string(name, default, comment) \
|
||||
WEBRTC_DEFINE_FLAG(STRING, const char*, name, default, comment)
|
||||
|
||||
// Use the following macros to declare a flag defined elsewhere:
|
||||
#define DECLARE_bool(name) DECLARE_FLAG(bool, name)
|
||||
#define DECLARE_int(name) DECLARE_FLAG(int, name)
|
||||
#define DECLARE_float(name) DECLARE_FLAG(double, name)
|
||||
#define DECLARE_string(name) DECLARE_FLAG(const char*, name)
|
||||
#define WEBRTC_DECLARE_bool(name) WEBRTC_DECLARE_FLAG(bool, name)
|
||||
#define WEBRTC_DECLARE_int(name) WEBRTC_DECLARE_FLAG(int, name)
|
||||
#define WEBRTC_DECLARE_float(name) WEBRTC_DECLARE_FLAG(double, name)
|
||||
#define WEBRTC_DECLARE_string(name) WEBRTC_DECLARE_FLAG(const char*, name)
|
||||
|
||||
// The global list of all flags.
|
||||
class FlagList {
|
||||
|
||||
Reference in New Issue
Block a user