Skip to content

Commit 6b4fd20

Browse files
committed
Avoid warning about unsigned/enum type mix in conditional expression
The enum values serve as bits in a bit field, convert them to unsigned.
1 parent 96a71f6 commit 6b4fd20

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/goto-diff/change_impact.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ void change_impactt::output_change_impact(
568568
{
569569
goto_program_change_impactt::const_iterator c_entry=
570570
c_i.find(target);
571-
const unsigned mod_flags=
572-
c_entry==c_i.end() ? SAME : c_entry->second;
571+
const unsigned mod_flags =
572+
c_entry == c_i.end() ? static_cast<unsigned>(SAME) : c_entry->second;
573573

574574
char prefix = ' ';
575575
// syntactic changes are preferred over data/control-dependence
@@ -623,8 +623,9 @@ void change_impactt::output_change_impact(
623623
{
624624
goto_program_change_impactt::const_iterator o_c_entry=
625625
o_c_i.find(o_target);
626-
const unsigned old_mod_flags=
627-
o_c_entry==o_c_i.end() ? SAME : o_c_entry->second;
626+
const unsigned old_mod_flags = o_c_entry == o_c_i.end()
627+
? static_cast<unsigned>(SAME)
628+
: o_c_entry->second;
628629

629630
if(old_mod_flags&DELETED)
630631
{
@@ -636,8 +637,8 @@ void change_impactt::output_change_impact(
636637

637638
goto_program_change_impactt::const_iterator c_entry=
638639
n_c_i.find(target);
639-
const unsigned mod_flags=
640-
c_entry==n_c_i.end() ? SAME : c_entry->second;
640+
const unsigned mod_flags =
641+
c_entry == n_c_i.end() ? static_cast<unsigned>(SAME) : c_entry->second;
641642

642643
char prefix = ' ';
643644
// syntactic changes are preferred over data/control-dependence
@@ -688,8 +689,9 @@ void change_impactt::output_change_impact(
688689
{
689690
goto_program_change_impactt::const_iterator o_c_entry=
690691
o_c_i.find(o_target);
691-
const unsigned old_mod_flags=
692-
o_c_entry==o_c_i.end() ? SAME : o_c_entry->second;
692+
const unsigned old_mod_flags = o_c_entry == o_c_i.end()
693+
? static_cast<unsigned>(SAME)
694+
: o_c_entry->second;
693695

694696
char prefix = ' ';
695697
// syntactic changes are preferred over data/control-dependence

0 commit comments

Comments
 (0)