Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/CMakeLists.txt b/CMakeLists.txt 2index 846b4448..b4900ead 100644 3--- a/CMakeLists.txt 4+++ b/CMakeLists.txt 5@@ -39,6 +39,7 @@ option (PRINT_UNSYMBOLIZED_STACK_TRACES 6 "Print file offsets in traces instead of symbolizing" OFF) 7 option (WITH_CUSTOM_PREFIX "Enable support for user-generated message prefixes" ON) 8 option (WITH_GFLAGS "Use gflags" ON) 9+option (WITH_ABSL "Use absl flags" OFF) 10 option (WITH_GTEST "Use Google Test" ON) 11 option (WITH_PKGCONFIG "Enable pkg-config support" ON) 12 option (WITH_SYMBOLIZE "Enable symbolize module" ON) 13@@ -87,6 +88,13 @@ if (WITH_GFLAGS) 14 endif (gflags_FOUND) 15 endif (WITH_GFLAGS) 16 17+if (WITH_ABSL) 18+ set (HAVE_ABSL_FLAGS 1) 19+ set (ac_cv_have_abslflags 1) 20+else (WITH_ABSL) 21+set (ac_cv_have_abslflags 0) 22+endif (WITH_ABSL) 23+ 24 find_package (Threads) 25 find_package (Unwind) 26 27@@ -1025,7 +1033,7 @@ write_basic_package_version_file ( 28 ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake 29 COMPATIBILITY SameMajorVersion) 30 31-export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake) 32+# export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake) 33 export (PACKAGE glog) 34 35 get_filename_component (_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) 36diff --git a/src/base/commandlineflags.h b/src/base/commandlineflags.h 37index bcb12dea..1c9d9294 100644 38--- a/src/base/commandlineflags.h 39+++ b/src/base/commandlineflags.h 40@@ -57,6 +57,25 @@ 41 42 #include <gflags/gflags.h> 43 44+#else 45+#ifdef HAVE_ABSL_FLAGS 46+#include <absl/flags/flag.h> 47+ 48+#define FLAG(name) absl::GetFlag(FLAGS_##name) 49+ 50+#define DEFINE_bool(name, value, meaning) \ 51+ ABSL_FLAG(bool, name, value, meaning) 52+ 53+#define DEFINE_int32(name, value, meaning) \ 54+ ABSL_FLAG(GOOGLE_NAMESPACE::int32, name, value, meaning) 55+ 56+#define DEFINE_uint32(name, value, meaning) \ 57+ ABSL_FLAG(GOOGLE_NAMESPACE::uint32, name, value, meaning) 58+ 59+#define DEFINE_string(name, value, meaning) \ 60+ ABSL_FLAG(std::string, name, value, meaning) 61+ 62+ 63 #else 64 65 #include <glog/logging.h> 66@@ -108,6 +127,7 @@ 67 } \ 68 using fLS::FLAGS_##name 69 70+#endif 71 #endif // HAVE_LIB_GFLAGS 72 73 // Define GLOG_DEFINE_* using DEFINE_* . By using these macros, we 74diff --git a/src/base/mutex.h b/src/base/mutex.h 75index e82c597f..a58c1412 100644 76--- a/src/base/mutex.h 77+++ b/src/base/mutex.h 78@@ -319,11 +319,6 @@ class WriterMutexLock { 79 void operator=(const WriterMutexLock&); 80 }; 81 82-// Catch bug where variable name is omitted, e.g. MutexLock (&mu); 83-#define MutexLock(x) COMPILE_ASSERT(0, mutex_lock_decl_missing_var_name) 84-#define ReaderMutexLock(x) COMPILE_ASSERT(0, rmutex_lock_decl_missing_var_name) 85-#define WriterMutexLock(x) COMPILE_ASSERT(0, wmutex_lock_decl_missing_var_name) 86- 87 } // namespace MUTEX_NAMESPACE 88 89 using namespace MUTEX_NAMESPACE; 90diff --git a/src/config.h.cmake.in b/src/config.h.cmake.in 91index b225b7ec..a4c58c96 100644 92--- a/src/config.h.cmake.in 93+++ b/src/config.h.cmake.in 94@@ -34,6 +34,8 @@ 95 /* define if you have google gflags library */ 96 #cmakedefine HAVE_LIB_GFLAGS 97 98+#cmakedefine HAVE_ABSL_FLAGS 99+ 100 /* define if you have google gmock library */ 101 #cmakedefine HAVE_LIB_GMOCK 102 103diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in 104index 95a573b1..54cd838f 100644 105--- a/src/glog/logging.h.in 106+++ b/src/glog/logging.h.in 107@@ -89,6 +89,10 @@ 108 #include <gflags/gflags.h> 109 #endif 110 111+#if @ac_cv_have_abslflags@ 112+#include <absl/flags/declare.h> 113+#endif 114+ 115 #if @ac_cv_cxx11_atomic@ && __cplusplus >= 201103L 116 #include <atomic> 117 #elif defined(GLOG_OS_WINDOWS) 118@@ -395,6 +399,14 @@ typedef void(*CustomPrefixCallback)(std::ostream& s, const LogMessageInfo& l, vo 119 #undef DECLARE_uint32 120 #endif 121 122+#if @ac_cv_have_abslflags@ 123+#define DECLARE_VARIABLE 1 124+#define DECLARE_bool(name) ABSL_DECLARE_FLAG(bool, name) 125+#define DECLARE_int32(name) ABSL_DECLARE_FLAG(@ac_google_namespace@::int32, name) 126+#define DECLARE_uint32(name) ABSL_DECLARE_FLAG(@ac_google_namespace@::uint32, name) 127+#define DECLARE_string(name) ABSL_DECLARE_FLAG(std::string, name) 128+#endif 129+ 130 #ifndef DECLARE_VARIABLE 131 #define DECLARE_VARIABLE(type, shorttype, name, tn) \ 132 namespace fL##shorttype { \ 133diff --git a/src/glog/vlog_is_on.h.in b/src/glog/vlog_is_on.h.in 134index 7526fc34..16e60f46 100644 135--- a/src/glog/vlog_is_on.h.in 136+++ b/src/glog/vlog_is_on.h.in 137@@ -64,6 +64,14 @@ 138 #include <glog/log_severity.h> 139 140 #if defined(__GNUC__) 141+ 142+#if @ac_cv_have_abslflags@ 143+ extern int32_t absl_proxy_v; 144+ #define VLEVEL (@ac_google_namespace@::absl_proxy_v) 145+#else 146+ #define VLEVEL (FLAGS_v) 147+#endif 148+ 149 // We emit an anonymous static int* variable at every VLOG_IS_ON(n) site. 150 // (Normally) the first time every VLOG_IS_ON(n) site is hit, 151 // we determine what variable will dynamically control logging at this site: 152@@ -74,7 +82,7 @@ 153 __extension__ \ 154 ({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \ 155 @ac_google_namespace@::int32 verbose_level__ = (verboselevel); \ 156- (vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \ 157+ (vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &VLEVEL, \ 158 __FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \ 159 }) 160 #else 161diff --git a/src/logging.cc b/src/logging.cc 162index 4028ccc0..fc618d3a 100644 163--- a/src/logging.cc 164+++ b/src/logging.cc 165@@ -103,7 +103,9 @@ using std::fdopen; 166 #endif 167 168 // There is no thread annotation support. 169+#ifndef EXCLUSIVE_LOCKS_REQUIRED 170 #define EXCLUSIVE_LOCKS_REQUIRED(mu) 171+#endif 172 173 static bool BoolFromEnv(const char *varname, bool defval) { 174 const char* const valstr = getenv(varname); 175@@ -351,8 +353,9 @@ static const char* GetAnsiColorCode(GLogColor color) { 176 177 // Safely get max_log_size, overriding to 1 if it somehow gets defined as 0 178 static uint32 MaxLogSize() { 179- return (FLAGS_max_log_size > 0 && FLAGS_max_log_size < 4096 180- ? FLAGS_max_log_size 181+ uint32 maxlogsize = FLAG(max_log_size); 182+ return (maxlogsize > 0 && maxlogsize < 4096 183+ ? maxlogsize 184 : 1); 185 } 186 187@@ -721,7 +724,7 @@ inline void LogDestination::SetStderrLogging(LogSeverity min_severity) { 188 // Prevent any subtle race conditions by wrapping a mutex lock around 189 // all this stuff. 190 MutexLock l(&log_mutex); 191- FLAGS_stderrthreshold = min_severity; 192+ absl::SetFlag(&FLAGS_stderrthreshold, min_severity); 193 } 194 195 inline void LogDestination::LogToStderr() { 196@@ -747,8 +750,8 @@ static void ColoredWriteToStderrOrStdout(FILE* output, LogSeverity severity, 197 const char* message, size_t len) { 198 bool is_stdout = (output == stdout); 199 const GLogColor color = (LogDestination::terminal_supports_color() && 200- ((!is_stdout && FLAGS_colorlogtostderr) || 201- (is_stdout && FLAGS_colorlogtostdout))) 202+ ((!is_stdout && FLAG(colorlogtostderr)) || 203+ (is_stdout && FLAG(colorlogtostdout)))) 204 ? SeverityToColor(severity) 205 : COLOR_DEFAULT; 206 207@@ -789,7 +792,7 @@ static void ColoredWriteToStdout(LogSeverity severity, const char* message, 208 FILE* output = stdout; 209 // We also need to send logs to the stderr when the severity is 210 // higher or equal to the stderr threshold. 211- if (severity >= FLAGS_stderrthreshold) { 212+ if (severity >= FLAG(stderrthreshold)) { 213 output = stderr; 214 } 215 ColoredWriteToStderrOrStdout(output, severity, message, len); 216@@ -808,7 +811,7 @@ static void WriteToStderr(const char* message, size_t len) { 217 218 inline void LogDestination::MaybeLogToStderr(LogSeverity severity, 219 const char* message, size_t message_len, size_t prefix_len) { 220- if ((severity >= FLAGS_stderrthreshold) || FLAGS_alsologtostderr) { 221+ if ((severity >= FLAG(stderrthreshold)) || FLAG(alsologtostderr)) { 222 ColoredWriteToStderr(severity, message, message_len); 223 #ifdef GLOG_OS_WINDOWS 224 (void) prefix_len; 225@@ -835,8 +838,8 @@ inline void LogDestination::MaybeLogToStderr(LogSeverity severity, 226 inline void LogDestination::MaybeLogToEmail(LogSeverity severity, 227 const char* message, size_t len) { 228 if (severity >= email_logging_severity_ || 229- severity >= FLAGS_logemaillevel) { 230- string to(FLAGS_alsologtoemail); 231+ severity >= FLAG(logemaillevel)) { 232+ string to(FLAG(alsologtoemail)); 233 if (!addresses_.empty()) { 234 if (!to.empty()) { 235 to += ","; 236@@ -862,7 +865,7 @@ inline void LogDestination::MaybeLogToLogfile(LogSeverity severity, 237 time_t timestamp, 238 const char* message, 239 size_t len) { 240- const bool should_flush = severity > FLAGS_logbuflevel; 241+ const bool should_flush = severity > FLAG(logbuflevel); 242 LogDestination* destination = log_destination(severity); 243 destination->logger_->Write(should_flush, timestamp, message, len); 244 } 245@@ -871,9 +874,9 @@ inline void LogDestination::LogToAllLogfiles(LogSeverity severity, 246 time_t timestamp, 247 const char* message, 248 size_t len) { 249- if (FLAGS_logtostdout) { // global flag: never log to file 250+ if (FLAG(logtostdout)) { // global flag: never log to file 251 ColoredWriteToStdout(severity, message, len); 252- } else if (FLAGS_logtostderr) { // global flag: never log to file 253+ } else if (FLAG(logtostderr)) { // global flag: never log to file 254 ColoredWriteToStderr(severity, message, len); 255 } else { 256 for (int i = severity; i >= 0; --i) { 257@@ -1032,25 +1035,25 @@ void LogFileObject::FlushUnlocked(){ 258 bytes_since_flush_ = 0; 259 } 260 // Figure out when we are due for another flush. 261- const int64 next = (FLAGS_logbufsecs 262+ const int64 next = (FLAG(logbufsecs) 263 * static_cast<int64>(1000000)); // in usec 264 next_flush_time_ = CycleClock_Now() + UsecToCycles(next); 265 } 266 267 bool LogFileObject::CreateLogfile(const string& time_pid_string) { 268 string string_filename = base_filename_; 269- if (FLAGS_timestamp_in_logfile_name) { 270+ if (FLAG(timestamp_in_logfile_name)) { 271 string_filename += time_pid_string; 272 } 273 string_filename += filename_extension_; 274 const char* filename = string_filename.c_str(); 275 //only write to files, create if non-existant. 276 int flags = O_WRONLY | O_CREAT; 277- if (FLAGS_timestamp_in_logfile_name) { 278+ if (FLAG(timestamp_in_logfile_name)) { 279 //demand that the file is unique for our timestamp (fail if it exists). 280 flags = flags | O_EXCL; 281 } 282- int fd = open(filename, flags, FLAGS_logfile_mode); 283+ int fd = open(filename, flags, FLAG(logfile_mode)); 284 if (fd == -1) return false; 285 #ifdef HAVE_FCNTL 286 // Mark the file close-on-exec. We don't really care if this fails 287@@ -1083,7 +1086,7 @@ bool LogFileObject::CreateLogfile(const string& time_pid_string) { 288 file_ = fdopen(fd, "a"); // Make a FILE*. 289 if (file_ == NULL) { // Man, we're screwed! 290 close(fd); 291- if (FLAGS_timestamp_in_logfile_name) { 292+ if (FLAG(timestamp_in_logfile_name)) { 293 unlink(filename); // Erase the half-baked evidence: an unusable log file, only if we just created it. 294 } 295 return false; 296@@ -1125,8 +1128,8 @@ bool LogFileObject::CreateLogfile(const string& time_pid_string) { 297 298 // Make an additional link to the log file in a place specified by 299 // FLAGS_log_link, if indicated 300- if (!FLAGS_log_link.empty()) { 301- linkpath = FLAGS_log_link + "/" + linkname; 302+ if (!FLAG(log_link).empty()) { 303+ linkpath = FLAG(log_link) + "/" + linkname; 304 unlink(linkpath.c_str()); // delete old one if it exists 305 if (symlink(filename, linkpath.c_str()) != 0) { 306 // silently ignore failures 307@@ -1165,7 +1168,7 @@ void LogFileObject::Write(bool force_flush, 308 rollover_attempt_ = 0; 309 310 struct ::tm tm_time; 311- if (FLAGS_log_utc_time) { 312+ if (FLAG(log_utc_time)) { 313 gmtime_r(&timestamp, &tm_time); 314 } else { 315 localtime_r(&timestamp, &tm_time); 316@@ -1253,14 +1256,14 @@ void LogFileObject::Write(bool force_flush, 317 << ' ' 318 << setw(2) << tm_time.tm_hour << ':' 319 << setw(2) << tm_time.tm_min << ':' 320- << setw(2) << tm_time.tm_sec << (FLAGS_log_utc_time ? " UTC\n" : "\n") 321+ << setw(2) << tm_time.tm_sec << (FLAG(log_utc_time) ? " UTC\n" : "\n") 322 << "Running on machine: " 323 << LogDestination::hostname() << '\n'; 324 325 if(!g_application_fingerprint.empty()) { 326 file_header_stream << "Application fingerprint: " << g_application_fingerprint << '\n'; 327 } 328- const char* const date_time_format = FLAGS_log_year_in_prefix 329+ const char* const date_time_format = FLAG(log_year_in_prefix) 330 ? "yyyymmdd hh:mm:ss.uuuuuu" 331 : "mmdd hh:mm:ss.uuuuuu"; 332 file_header_stream << "Running duration (h:mm:ss): " 333@@ -1284,7 +1287,7 @@ void LogFileObject::Write(bool force_flush, 334 // greater than 4096, thereby indicating an error. 335 errno = 0; 336 fwrite(message, 1, message_len, file_); 337- if ( FLAGS_stop_logging_if_full_disk && 338+ if ( FLAG(stop_logging_if_full_disk) && 339 errno == ENOSPC ) { // disk full, stop writing to disk 340 stop_writing = true; // until the disk is 341 return; 342@@ -1307,7 +1310,7 @@ void LogFileObject::Write(bool force_flush, 343 FlushUnlocked(); 344 #ifdef GLOG_OS_LINUX 345 // Only consider files >= 3MiB 346- if (FLAGS_drop_log_memory && file_length_ >= (3U << 20U)) { 347+ if (FLAG(drop_log_memory) && file_length_ >= (3U << 20U)) { 348 // Don't evict the most recent 1-2MiB so as not to impact a tailer 349 // of the log file and to avoid page rounding issue on linux < 4.7 350 uint32 total_drop_length = 351@@ -1348,7 +1351,7 @@ void LogCleaner::Disable() { 352 } 353 354 void LogCleaner::UpdateCleanUpTime() { 355- const int64 next = (FLAGS_logcleansecs 356+ const int64 next = (FLAG(logcleansecs) 357 * 1000000); // in usec 358 next_cleanup_time_ = CycleClock_Now() + UsecToCycles(next); 359 } 360@@ -1664,7 +1667,7 @@ void LogMessage::Init(const char* file, 361 // I20201018 160715 f5d4fbb0 logging.cc:1153] 362 // (log level, GMT year, month, date, time, thread_id, file basename, line) 363 // We exclude the thread_id for the default thread. 364- if (FLAGS_log_prefix && (line != kNoLogPrefix)) { 365+ if (FLAG(log_prefix) && (line != kNoLogPrefix)) { 366 std::ios saved_fmt(NULL); 367 saved_fmt.copyfmt(stream()); 368 stream().fill('0'); 369@@ -1672,7 +1675,7 @@ void LogMessage::Init(const char* file, 370 if (custom_prefix_callback == NULL) { 371 #endif 372 stream() << LogSeverityNames[severity][0]; 373- if (FLAGS_log_year_in_prefix) { 374+ if (FLAG(log_year_in_prefix)) { 375 stream() << setw(4) << 1900 + logmsgtime_.year(); 376 } 377 stream() << setw(2) << 1 + logmsgtime_.month() 378@@ -1703,11 +1706,11 @@ void LogMessage::Init(const char* file, 379 } 380 data_->num_prefix_chars_ = data_->stream_.pcount(); 381 382- if (!FLAGS_log_backtrace_at.empty()) { 383+ if (!FLAG(log_backtrace_at).empty()) { 384 char fileline[128]; 385 snprintf(fileline, sizeof(fileline), "%s:%d", data_->basename_, line); 386 #ifdef HAVE_STACKTRACE 387- if (FLAGS_log_backtrace_at == fileline) { 388+ if (FLAG(log_backtrace_at) == fileline) { 389 string stacktrace; 390 DumpStackTraceToString(&stacktrace); 391 stream() << " (stacktrace:\n" << stacktrace << ") "; 392@@ -1746,7 +1749,7 @@ ostream& LogMessage::stream() { 393 // Flush buffered message, called by the destructor, or any other function 394 // that needs to synchronize the log. 395 void LogMessage::Flush() { 396- if (data_->has_been_flushed_ || data_->severity_ < FLAGS_minloglevel) { 397+ if (data_->has_been_flushed_ || data_->severity_ < FLAG(minloglevel)) { 398 return; 399 } 400 401@@ -1808,7 +1811,7 @@ static char fatal_message[256]; 402 void ReprintFatalMessage() { 403 if (fatal_message[0]) { 404 const size_t n = strlen(fatal_message); 405- if (!FLAGS_logtostderr) { 406+ if (!FLAG(logtostderr)) { 407 // Also write to stderr (don't color to avoid terminal checks) 408 WriteToStderr(fatal_message, n); 409 } 410@@ -1837,8 +1840,8 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { 411 // global flag: never log to file if set. Also -- don't log to a 412 // file if we haven't parsed the command line flags to get the 413 // program name. 414- if (FLAGS_logtostderr || FLAGS_logtostdout || !IsGoogleLoggingInitialized()) { 415- if (FLAGS_logtostdout) { 416+ if (FLAG(logtostderr) || FLAG(logtostdout) || !IsGoogleLoggingInitialized()) { 417+ if (FLAG(logtostdout)) { 418 ColoredWriteToStdout(data_->severity_, data_->message_text_, 419 data_->num_chars_to_log_); 420 } else { 421@@ -1891,7 +1894,7 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) { 422 fatal_time = logmsgtime_.timestamp(); 423 } 424 425- if (!FLAGS_logtostderr && !FLAGS_logtostdout) { 426+ if (!FLAG(logtostderr) && !FLAG(logtostdout)) { 427 for (int i = 0; i < NUM_SEVERITIES; ++i) { 428 if (LogDestination::log_destinations_[i]) { 429 LogDestination::log_destinations_[i]->logger_->Write(true, 0, "", 0); 430@@ -2238,7 +2241,7 @@ static bool SendEmailInternal(const char*dest, const char *subject, 431 subject, body, dest); 432 } 433 434- string logmailer = FLAGS_logmailer; 435+ string logmailer = FLAG(logmailer); 436 if (logmailer.empty()) { 437 logmailer = "/bin/mail"; 438 } 439@@ -2338,9 +2341,9 @@ const vector<string>& GetLoggingDirectories() { 440 if (logging_directories_list == NULL) { 441 logging_directories_list = new vector<string>; 442 443- if ( !FLAGS_log_dir.empty() ) { 444+ if ( !FLAG(log_dir).empty() ) { 445 // A dir was specified, we should use it 446- logging_directories_list->push_back(FLAGS_log_dir); 447+ logging_directories_list->push_back(FLAG(log_dir)); 448 } else { 449 GetTempDirectories(logging_directories_list); 450 #ifdef GLOG_OS_WINDOWS 451@@ -2654,7 +2657,7 @@ LogMessageTime::LogMessageTime(std::tm t) { 452 453 LogMessageTime::LogMessageTime(std::time_t timestamp, WallTime now) { 454 std::tm t; 455- if (FLAGS_log_utc_time) 456+ if (FLAG(log_utc_time)) 457 gmtime_r(&timestamp, &t); 458 else 459 localtime_r(&timestamp, &t); 460@@ -2673,7 +2676,7 @@ void LogMessageTime::init(const std::tm& t, std::time_t timestamp, 461 void LogMessageTime::CalcGmtOffset() { 462 std::tm gmt_struct; 463 int isDst = 0; 464- if ( FLAGS_log_utc_time ) { 465+ if ( FLAG(log_utc_time )) { 466 localtime_r(&timestamp_, &gmt_struct); 467 isDst = gmt_struct.tm_isdst; 468 gmt_struct = time_struct_; 469diff --git a/src/raw_logging.cc b/src/raw_logging.cc 470index 43159832..8532362b 100644 471--- a/src/raw_logging.cc 472+++ b/src/raw_logging.cc 473@@ -123,8 +123,8 @@ static char crash_buf[kLogBufSize + 1] = { 0 }; // Will end in '\0' 474 GLOG_ATTRIBUTE_FORMAT(printf, 4, 5) 475 void RawLog__(LogSeverity severity, const char* file, int line, 476 const char* format, ...) { 477- if (!(FLAGS_logtostdout || FLAGS_logtostderr || 478- severity >= FLAGS_stderrthreshold || FLAGS_alsologtostderr || 479+ if (!(FLAG(logtostdout) || FLAG(logtostderr) || 480+ severity >= FLAG(stderrthreshold) || FLAG(alsologtostderr) || 481 !IsGoogleLoggingInitialized())) { 482 return; // this stderr log message is suppressed 483 } 484diff --git a/src/utilities.cc b/src/utilities.cc 485index a332f1a1..a9d5102a 100644 486--- a/src/utilities.cc 487+++ b/src/utilities.cc 488@@ -141,7 +141,7 @@ static void DumpStackTrace(int skip_count, DebugWriter *writerfn, void *arg) { 489 int depth = GetStackTrace(stack, ARRAYSIZE(stack), skip_count+1); 490 for (int i = 0; i < depth; i++) { 491 #if defined(HAVE_SYMBOLIZE) 492- if (FLAGS_symbolize_stacktrace) { 493+ if (FLAG(symbolize_stacktrace)) { 494 DumpPCAndSymbol(writerfn, arg, stack[i], " "); 495 } else { 496 DumpPC(writerfn, arg, stack[i], " "); 497diff --git a/src/vlog_is_on.cc b/src/vlog_is_on.cc 498index e478a366..4b7a5cae 100644 499--- a/src/vlog_is_on.cc 500+++ b/src/vlog_is_on.cc 501@@ -43,14 +43,24 @@ 502 #include <glog/logging.h> 503 #include <glog/raw_logging.h> 504 #include "base/googleinit.h" 505+#include "config.h" 506 507 // glog doesn't have annotation 508 #define ANNOTATE_BENIGN_RACE(address, description) 509 510 using std::string; 511 512+#ifdef HAVE_ABSL_FLAGS 513+ 514+ABSL_FLAG(int32_t, v, 0, "Show all VLOG(m) messages for m <= this." 515+" Overridable by --vmodule.").OnUpdate([] { 516+ GOOGLE_NAMESPACE::absl_proxy_v = absl::GetFlag(FLAGS_v); 517+ }); 518+ 519+#else 520 GLOG_DEFINE_int32(v, 0, "Show all VLOG(m) messages for m <= this." 521 " Overridable by --vmodule."); 522+#endif 523 524 GLOG_DEFINE_string(vmodule, "", "per-module verbose level." 525 " Argument is a comma-separated list of <module name>=<log level>." 526@@ -60,6 +70,8 @@ GLOG_DEFINE_string(vmodule, "", "per-module verbose level." 527 528 _START_GOOGLE_NAMESPACE_ 529 530+int32_t absl_proxy_v = 0; 531+ 532 namespace glog_internal_namespace_ { 533 534 // Used by logging_unittests.cc so can't make it static here. 535@@ -132,7 +144,8 @@ static void VLOG2Initializer() { 536 // Can now parse --vmodule flag and initialize mapping of module-specific 537 // logging levels. 538 inited_vmodule = false; 539- const char* vmodule = FLAGS_vmodule.c_str(); 540+ string vmodule_str = FLAG(vmodule); 541+ const char* vmodule = vmodule_str.c_str(); 542 const char* sep; 543 VModuleInfo* head = NULL; 544 VModuleInfo* tail = NULL; 545@@ -164,7 +177,7 @@ static void VLOG2Initializer() { 546 547 // This can be called very early, so we use SpinLock and RAW_VLOG here. 548 int SetVLOGLevel(const char* module_pattern, int log_level) { 549- int result = FLAGS_v; 550+ int result = FLAG(v); 551 size_t const pattern_len = strlen(module_pattern); 552 bool found = false; 553 {