Skip to content

Commit

Permalink
Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_gam…
Browse files Browse the repository at this point in the history
…es/pcf2_attribution/AttributionRule_impl.h (#9310)

Summary:
Pull Request resolved: #9310

X-link: facebookincubator/dynolog#89

X-link: facebookresearch/fbpcf#462

X-link: facebookresearch/fbpcs#2016

With LLVM-15, `&&` and `||` are required for boolean operands, rather than `&` and `|` which can be confused for bitwise operations. Fixing such ambiguity helps makes our code more readable.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Differential Revision: D42347735

fbshipit-source-id: 3ec9c8af880cfce6490787662a4c3bc28f990bc7
  • Loading branch information
r-barnes authored and facebook-github-bot committed Jan 7, 2023
1 parent f1e8bcb commit dd4be07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions hphp/runtime/base/runtime-option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,17 @@ static std::vector<std::string> getTierOverwrites(IniSetting::Map& ini,
// Check the patterns one by one so they all get evaluated; otherwise, when
// using "&&" in a single expression with multiple patterns, if an earlier
// one fails to match, the later one would be reported as unused.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
auto matched = true;
matched &= Config::matchHdfPattern(hostname, ini, hdf, "machine");
matched &= Config::matchHdfPattern(tier, ini, hdf, "tier");
matched &= Config::matchHdfPattern(task, ini, hdf, "task");
matched &= Config::matchHdfPattern(tiers, ini, hdf, "tiers", "m");
matched &= Config::matchHdfPattern(tags, ini, hdf, "tags", "m");
matched &= Config::matchHdfPattern(cpu, ini, hdf, "cpu");
#pragma clang diagnostic pop

return matched;
};

Expand All @@ -1433,10 +1437,14 @@ static std::vector<std::string> getTierOverwrites(IniSetting::Map& ini,
// Check the patterns one by one so they all get evaluated; otherwise, when
// using "&&" in a single expression with multiple patterns, if an earlier
// one fails to match, the later one would be reported as unused.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
auto matched = true;
matched &= checkPatterns(hdf);
matched &= !hdf.exists("exclude") || !checkPatterns(hdf["exclude"]);
matched &= matchShard(enableShards, hostname, ini, hdf, messages);
#pragma clang diagnostic pop

return matched;
};

Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ String HSLLocaleLibcOps::replace_every_nonrecursive_ci(const String& haystack,
haystack,
replacements,
/* to_t = */ id,
/* from_t = */ id,
/* from_t = */ id,
/* normalize = */ [](String* s) {},
[](String* s) {
*s = HHVM_FN(strtolower)(*s);
Expand Down

0 comments on commit dd4be07

Please sign in to comment.