From 573995d1f5f12712c397520292da3e5b797ad98a Mon Sep 17 00:00:00 2001 From: Matthias Maennich via libabigail Date: Mon, 15 Apr 2019 18:05:21 +0100 Subject: [PATCH] distinct_diff: avoid expression with side effects within typeid When compiling with clang, the following warning is emitted: abg-comparison.cc:2674:17: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Wpotentially-evaluated-expression] return typeid(*first.get()) != typeid(*second.get()); ^ Mitigate that warning by moving potential side effects out of typeid. * src/abg-comparison.cc: fix clang warning "potentially-evaluated-expression" Signed-off-by: Matthias Maennich --- src/abg-comparison.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 8a663678..ed5e0588 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -2671,7 +2671,8 @@ distinct_diff::entities_are_of_distinct_kinds(type_or_decl_base_sptr first, if (first == second) return false; - return typeid(*first.get()) != typeid(*second.get()); + const type_or_decl_base &f = *first, &s = *second; + return typeid(f) != typeid(s); } /// @return true if the two subjects of the diff are different, false -- 2.43.5