Make flags use the DEFINE_FLAG() style.

Change-Id: I5257acf15a15d2dc6dbcc76149505c5fea5b8def
Reviewed-on: https://code-review.googlesource.com/c/re2/+/46821
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/testing/dfa_test.cc b/re2/testing/dfa_test.cc
index f0c6ffc..caf3fa1 100644
--- a/re2/testing/dfa_test.cc
+++ b/re2/testing/dfa_test.cc
@@ -20,9 +20,9 @@
 
 static const bool UsingMallocCounter = false;
 
-DEFINE_int32(size, 8, "log2(number of DFA nodes)");
-DEFINE_int32(repeat, 2, "Repetition count.");
-DEFINE_int32(threads, 4, "number of threads");
+DEFINE_FLAG(int, size, 8, "log2(number of DFA nodes)");
+DEFINE_FLAG(int, repeat, 2, "Repetition count.");
+DEFINE_FLAG(int, threads, 4, "number of threads");
 
 namespace re2 {
 
diff --git a/re2/testing/exhaustive_tester.cc b/re2/testing/exhaustive_tester.cc
index a71c406..d75e23d 100644
--- a/re2/testing/exhaustive_tester.cc
+++ b/re2/testing/exhaustive_tester.cc
@@ -25,11 +25,11 @@
 #define LOGGING 0
 #endif
 
-DEFINE_bool(show_regexps, false, "show regexps during testing");
+DEFINE_FLAG(bool, show_regexps, false, "show regexps during testing");
 
-DEFINE_int32(max_bad_regexp_inputs, 1,
-             "Stop testing a regular expression after finding this many "
-             "strings that break it.");
+DEFINE_FLAG(int, max_bad_regexp_inputs, 1,
+            "Stop testing a regular expression after finding this many "
+            "strings that break it.");
 
 namespace re2 {
 
diff --git a/re2/testing/random_test.cc b/re2/testing/random_test.cc
index 011f35f..4920925 100644
--- a/re2/testing/random_test.cc
+++ b/re2/testing/random_test.cc
@@ -12,10 +12,10 @@
 #include "util/flags.h"
 #include "re2/testing/exhaustive_tester.h"
 
-DEFINE_int32(regexpseed, 404, "Random regexp seed.");
-DEFINE_int32(regexpcount, 100, "How many random regexps to generate.");
-DEFINE_int32(stringseed, 200, "Random string seed.");
-DEFINE_int32(stringcount, 100, "How many random strings to generate.");
+DEFINE_FLAG(int, regexpseed, 404, "Random regexp seed.");
+DEFINE_FLAG(int, regexpcount, 100, "How many random regexps to generate.");
+DEFINE_FLAG(int, stringseed, 200, "Random string seed.");
+DEFINE_FLAG(int, stringcount, 100, "How many random strings to generate.");
 
 namespace re2 {
 
@@ -97,4 +97,3 @@
 }
 
 }  // namespace re2
-
diff --git a/re2/testing/regexp_benchmark.cc b/re2/testing/regexp_benchmark.cc
index 33325c0..d501f1f 100644
--- a/re2/testing/regexp_benchmark.cc
+++ b/re2/testing/regexp_benchmark.cc
@@ -731,7 +731,8 @@
 
 }  // namespace re2
 
-DEFINE_string(compile_regexp, "(.*)-(\\d+)-of-(\\d+)", "regexp for compile benchmarks");
+DEFINE_FLAG(std::string, compile_regexp, "(.*)-(\\d+)-of-(\\d+)",
+            "regexp for compile benchmarks");
 
 namespace re2 {
 
diff --git a/re2/testing/tester.cc b/re2/testing/tester.cc
index f08d717..8f9c310 100644
--- a/re2/testing/tester.cc
+++ b/re2/testing/tester.cc
@@ -18,14 +18,15 @@
 #include "re2/re2.h"
 #include "re2/regexp.h"
 
-DEFINE_bool(dump_prog, false, "dump regexp program");
-DEFINE_bool(log_okay, false, "log successful runs");
-DEFINE_bool(dump_rprog, false, "dump reversed regexp program");
+DEFINE_FLAG(bool, dump_prog, false, "dump regexp program");
+DEFINE_FLAG(bool, log_okay, false, "log successful runs");
+DEFINE_FLAG(bool, dump_rprog, false, "dump reversed regexp program");
 
-DEFINE_int32(max_regexp_failures, 100,
-             "maximum number of regexp test failures (-1 = unlimited)");
+DEFINE_FLAG(int, max_regexp_failures, 100,
+            "maximum number of regexp test failures (-1 = unlimited)");
 
-DEFINE_string(regexp_engines, "", "pattern to select regexp engines to test");
+DEFINE_FLAG(std::string, regexp_engines, "",
+            "pattern to select regexp engines to test");
 
 namespace re2 {
 
diff --git a/util/flags.h b/util/flags.h
index e0f1f42..0ae526d 100644
--- a/util/flags.h
+++ b/util/flags.h
@@ -10,20 +10,10 @@
 // If you want to do that, see
 // https://gflags.github.io/gflags/
 
-#include <stdint.h>
-
-#define DEFINE_flag(type, name, deflt, desc) \
+#define DEFINE_FLAG(type, name, deflt, desc) \
 	namespace re2 { type FLAGS_##name = deflt; }
 
-#define DECLARE_flag(type, name) \
+#define DECLARE_FLAG(type, name) \
 	namespace re2 { extern type FLAGS_##name; }
 
-#define DEFINE_bool(name, deflt, desc) DEFINE_flag(bool, name, deflt, desc)
-#define DEFINE_int32(name, deflt, desc) DEFINE_flag(int32_t, name, deflt, desc)
-#define DEFINE_string(name, deflt, desc) DEFINE_flag(std::string, name, deflt, desc)
-
-#define DECLARE_bool(name) DECLARE_flag(bool, name)
-#define DECLARE_int32(name) DECLARE_flag(int32_t, name)
-#define DECLARE_string(name) DECLARE_flag(std::string, name)
-
 #endif  // UTIL_FLAGS_H_
diff --git a/util/pcre.cc b/util/pcre.cc
index 5983c9f..203f8ab 100644
--- a/util/pcre.cc
+++ b/util/pcre.cc
@@ -35,9 +35,10 @@
 // not exceed main thread stacks.  Note that other threads
 // often have smaller stacks, and therefore tightening
 // regexp_stack_limit may frequently be necessary.
-DEFINE_int32(regexp_stack_limit, 256<<10, "default PCRE stack limit (bytes)");
-DEFINE_int32(regexp_match_limit, 1000000,
-             "default PCRE match limit (function calls)");
+DEFINE_FLAG(int, regexp_stack_limit, 256 << 10,
+            "default PCRE stack limit (bytes)");
+DEFINE_FLAG(int, regexp_match_limit, 1000000,
+            "default PCRE match limit (function calls)");
 
 #ifndef USEPCRE