Commit 14ec87e2 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[flags] Fix another weird printing of contradictions

Move the logic to negate a flag properly if the name starts with '!' to
the general {FlagName} helper. This fixes an otherwise weird formatting.

Before:
# Contradictory flag implications from --!liftoff and --wasm-speculative-inlining for flag --wasm-dynamic-tiering.

After:
# Contradictory flag implications from --no-liftoff and --wasm-speculative-inlining for flag --wasm-dynamic-tiering.

R=tebbi@chromium.org

Change-Id: I21236b4ff338aa4d2ddd0872f85e2362ef8dc813
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3870915
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82943}
parent 52c90d78
...@@ -56,7 +56,16 @@ Flag* FindFlagByName(const char* name); ...@@ -56,7 +56,16 @@ Flag* FindFlagByName(const char* name);
// Helper struct for printing normalized flag names. // Helper struct for printing normalized flag names.
struct FlagName { struct FlagName {
const char* name; const char* name;
bool negated = false; bool negated;
constexpr FlagName(const char* name, bool negated)
: name(name), negated(negated) {
DCHECK_NE('\0', name[0]);
DCHECK_NE('!', name[0]);
}
constexpr explicit FlagName(const char* name)
: FlagName(name[0] == '!' ? name + 1 : name, name[0] == '!') {}
}; };
std::ostream& operator<<(std::ostream& os, FlagName flag_name) { std::ostream& operator<<(std::ostream& os, FlagName flag_name) {
...@@ -227,8 +236,9 @@ struct Flag { ...@@ -227,8 +236,9 @@ struct Flag {
} }
if (ShouldCheckFlagContradictions()) { if (ShouldCheckFlagContradictions()) {
static constexpr const char kHint[] = static constexpr const char kHint[] =
"To fix this, it might be necessary to specify additional " "If a test variant caused this, it might be necessary to specify "
"contradictory flags in tools/testrunner/local/variants.py."; "additional contradictory flags in "
"tools/testrunner/local/variants.py.";
struct FatalError : public std::ostringstream { struct FatalError : public std::ostringstream {
// MSVC complains about non-returning destructor; disable that. // MSVC complains about non-returning destructor; disable that.
MSVC_SUPPRESS_WARNING(4722) MSVC_SUPPRESS_WARNING(4722)
...@@ -852,10 +862,7 @@ class ImplicationProcessor { ...@@ -852,10 +862,7 @@ class ImplicationProcessor {
return false; return false;
} }
if (V8_UNLIKELY(num_iterations_ >= kMaxNumIterations)) { if (V8_UNLIKELY(num_iterations_ >= kMaxNumIterations)) {
cycle_ << "\n" cycle_ << "\n" << FlagName{premise_name} << " -> ";
<< (premise_name[0] == '!' ? FlagName{premise_name + 1, true}
: FlagName{premise_name})
<< " -> ";
if constexpr (std::is_same_v<T, bool>) { if constexpr (std::is_same_v<T, bool>) {
cycle_ << FlagName{conclusion_flag->name(), !value}; cycle_ << FlagName{conclusion_flag->name(), !value};
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment