Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_games/pcf2_attribution/AttributionRule_impl.h #9310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_gam…
…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
r-barnes authored and facebook-github-bot committed Jan 7, 2023
commit dd4be071bcca24089700bb0000709855eed767d6
8 changes: 8 additions & 0 deletions hphp/runtime/base/runtime-option.cpp
Original file line number Diff line number Diff line change
@@ -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;
};

@@ -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;
};

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
@@ -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);