* [PATCH] abipkgdiff: Address operator precedence warning
@ 2021-01-26 9:56 Matthias Maennich
2021-01-26 11:54 ` Giuliano Procida
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Maennich @ 2021-01-26 9:56 UTC (permalink / raw)
To: libabigail; +Cc: dodji, gprocida, kernel-team, maennich
When compiling with clang, it (rightfully) complains about an operator
precedence issue:
abipkgdiff.cc:1646:7: error: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
? string("Comparison against self SUCCEEDED\n")
^
Fix that by properly placing the parentheses. Also, drop the superfluous
string conversion.
* tools/abipkgdiff.cc (compare_to_self): address clang warning.
Signed-off-by: Matthias Maennich <maennich@google.com>
---
tools/abipkgdiff.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 783a8d9a5359..c2badadb5973 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -1642,9 +1642,9 @@ compare_to_self(const elf_file& elf,
if (opts.verbose)
emit_prefix("abipkgdfiff", cerr)
- << (s == abigail::tools_utils::ABIDIFF_OK)
- ? string("Comparison against self SUCCEEDED\n")
- : string("Comparison against self FAILED\n");
+ << "Comparison against self "
+ << (s == abigail::tools_utils::ABIDIFF_OK ? "SUCCEEDED" : "FAILED")
+ << '\n';
return s;
}
--
2.30.0.280.ga3ce27912f-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] abipkgdiff: Address operator precedence warning
2021-01-26 9:56 [PATCH] abipkgdiff: Address operator precedence warning Matthias Maennich
@ 2021-01-26 11:54 ` Giuliano Procida
2021-01-26 16:22 ` Dodji Seketeli
0 siblings, 1 reply; 3+ messages in thread
From: Giuliano Procida @ 2021-01-26 11:54 UTC (permalink / raw)
To: Matthias Maennich
Cc: Giuliano Procida via Libabigail, Dodji Seketeli, kernel-team
On Tue, 26 Jan 2021 at 09:57, Matthias Maennich <maennich@google.com> wrote:
>
> When compiling with clang, it (rightfully) complains about an operator
> precedence issue:
>
> abipkgdiff.cc:1646:7: error: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
> ? string("Comparison against self SUCCEEDED\n")
> ^
>
> Fix that by properly placing the parentheses. Also, drop the superfluous
> string conversion.
>
> * tools/abipkgdiff.cc (compare_to_self): address clang warning.
>
> Signed-off-by: Matthias Maennich <maennich@google.com>
Reviewed-by: Giuliano Procida <gprocida@google.com>
Looks good to me.
> ---
> tools/abipkgdiff.cc | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
> index 783a8d9a5359..c2badadb5973 100644
> --- a/tools/abipkgdiff.cc
> +++ b/tools/abipkgdiff.cc
> @@ -1642,9 +1642,9 @@ compare_to_self(const elf_file& elf,
>
> if (opts.verbose)
> emit_prefix("abipkgdfiff", cerr)
> - << (s == abigail::tools_utils::ABIDIFF_OK)
> - ? string("Comparison against self SUCCEEDED\n")
> - : string("Comparison against self FAILED\n");
> + << "Comparison against self "
> + << (s == abigail::tools_utils::ABIDIFF_OK ? "SUCCEEDED" : "FAILED")
> + << '\n';
> return s;
> }
>
> --
> 2.30.0.280.ga3ce27912f-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] abipkgdiff: Address operator precedence warning
2021-01-26 11:54 ` Giuliano Procida
@ 2021-01-26 16:22 ` Dodji Seketeli
0 siblings, 0 replies; 3+ messages in thread
From: Dodji Seketeli @ 2021-01-26 16:22 UTC (permalink / raw)
To: Giuliano Procida
Cc: Matthias Maennich, Giuliano Procida via Libabigail, kernel-team
Giuliano Procida <gprocida@google.com> a écrit:
> On Tue, 26 Jan 2021 at 09:57, Matthias Maennich <maennich@google.com> wrote:
>>
>> When compiling with clang, it (rightfully) complains about an operator
>> precedence issue:
>>
>> abipkgdiff.cc:1646:7: error: operator '?:' has lower precedence than '<<'; '<<' will be evaluated first [-Wparentheses]
>> ? string("Comparison against self SUCCEEDED\n")
>> ^
>>
>> Fix that by properly placing the parentheses. Also, drop the superfluous
>> string conversion.
>>
>> * tools/abipkgdiff.cc (compare_to_self): address clang warning.
>>
>> Signed-off-by: Matthias Maennich <maennich@google.com>
> Reviewed-by: Giuliano Procida <gprocida@google.com>
>
> Looks good to me.
Applied to master, thanks!
Cheers,
--
Dodji
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-26 16:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 9:56 [PATCH] abipkgdiff: Address operator precedence warning Matthias Maennich
2021-01-26 11:54 ` Giuliano Procida
2021-01-26 16:22 ` Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).