folly icon indicating copy to clipboard operation
folly copied to clipboard

always initialize local variable

Open tchaikov opened this issue 3 years ago • 1 comments

this change helps to silence gcc warning like

/usr/include/c++/12/bits/stl_construct.h:119:7: warning: ‘colored’ may be used uninitialized [-Wmaybe-uninitialized]
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
folly/folly/logging/StandardLogHandlerFactory.cpp: In member function ‘virtual std::shared_ptr<folly::LogFormatter> folly::{anonymous}::CustomLogFormatterFactory::createFormatter(const std::shared_ptr<folly::LogWriter>&)’:
folly/folly/logging/StandardLogHandlerFactory.cpp:73:10: note: ‘colored’ was declared here
   73 |     bool colored;
      |          ^~~~~~~

Signed-off-by: Kefu Chai [email protected]

tchaikov avatar Mar 19 '22 07:03 tchaikov

2057/2815 Test #2032: fbstring_test.FBString.testAllClauses ................................................................Subprocess aborted***Exception:   0.29 sec
Note: Google Test filter = FBString.testAllClauses
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from FBString
[ RUN      ] FBString.testAllClauses
/usr/bin/../lib/gcc/aarch64-redhat-linux/12/../../../../include/c++/12/bits/basic_string.h:1280: std::basic_string::reference std::basic_string<char>::front() [_CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]: Assertion '!empty()' failed.
*** Aborted at 1647792099 (Unix time, try 'date -d @1647792099') ***
*** Signal 6 (SIGABRT) (0x3e900007f13) received by PID 32531 (pthread TID 0xffffb9866020) (linux TID 32531) (maybe from PID 32531, UID 1001) (code: -6), stack trace: ***

tchaikov avatar Mar 20 '22 16:03 tchaikov