From dd4be071bcca24089700bb0000709855eed767d6 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Fri, 6 Jan 2023 16:21:43 -0800 Subject: [PATCH] Fix -Wbitwise-instead-of-logical in 5 files starting w/ fbpcs/emp_games/pcf2_attribution/AttributionRule_impl.h (#9310) Summary: Pull Request resolved: https://github.com/facebook/hhvm/pull/9310 X-link: https://github.com/facebookincubator/dynolog/pull/89 X-link: https://github.com/facebookresearch/fbpcf/pull/462 X-link: https://github.com/facebookresearch/fbpcs/pull/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 --- hphp/runtime/base/runtime-option.cpp | 8 ++++++++ hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hphp/runtime/base/runtime-option.cpp b/hphp/runtime/base/runtime-option.cpp index 8425b0c22570e..e0a6d1f33ce55 100644 --- a/hphp/runtime/base/runtime-option.cpp +++ b/hphp/runtime/base/runtime-option.cpp @@ -1416,6 +1416,8 @@ static std::vector 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"); @@ -1423,6 +1425,8 @@ static std::vector getTierOverwrites(IniSetting::Map& ini, 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 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; }; diff --git a/hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp b/hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp index 9022a955d4948..eaf5b08f98317 100644 --- a/hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp +++ b/hphp/runtime/ext/hsl/hsl_locale_libc_ops.cpp @@ -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);