Skip to content

Commit

Permalink
honor clang warnings uninitialized etc
Browse files Browse the repository at this point in the history
Summary:
It is almost always a bug to use uninitialized values, so enforce the warnings.

Specifially, honor these clang warnings:
```
uninitialized
conditional-uninitialized
sometimes-uninitialized
uninitialized-const-reference
```

Reviewed By: Orvid

Differential Revision: D34536731

fbshipit-source-id: 6f7b15181b7996df2f5a2f6500de007a5dffce7e
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Mar 1, 2022
1 parent 447d446 commit d4d4b94
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMake/FollyCompilerUnix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function(apply_folly_compile_options_to_target THETARGET)
-Wno-deprecated-declarations
-Wno-sign-compare
-Wno-unused
-Wuninitialized
-Wunused-label
-Wunused-result
${FOLLY_CXX_FLAGS}
Expand Down
2 changes: 1 addition & 1 deletion folly/experimental/FutureDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FutureDAG : public std::enable_shared_from_this<FutureDAG> {

void reset() {
// Delete all but source node, and reset dependency properties
Handle source_node;
Handle source_node = 0;
std::unordered_set<Handle> memo;
for (auto& node : nodes) {
for (Handle handle : node.dependencies) {
Expand Down
2 changes: 1 addition & 1 deletion folly/synchronization/detail/test/HardwareTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ TEST_F(HardwareTest, RtmBasicUsage) {
EXPECT_FALSE(rtmEnabled());
}

unsigned status;
unsigned status = 0;
static constexpr uint8_t kAbortCode = 1;
unsigned successCounts = 0;
unsigned abortCounts = 0;
Expand Down
3 changes: 2 additions & 1 deletion folly/test/FBStringTestBenchmarks.cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ void BENCHFUN(resize)(size_t iters, size_t arg) {
BENCHMARK_PARAM(BENCHFUN(resize), 524288)

void BENCHFUN(findSuccessful)(size_t iters, size_t /* arg */) {
size_t pos, len;
size_t pos = 0;
size_t len = 0;
STRING s;

BENCHMARK_SUSPEND {
Expand Down

0 comments on commit d4d4b94

Please sign in to comment.