Fix another gcc7 warning.

Warning is:

/home/johanna/bro/master/src/Type.cc: In member function 'virtual bool IndexType::DoUnserialize(UnserialInfo*)':
/home/johanna/bro/master/src/Type.cc:548:60: warning: enum constant in boolean context [-Wint-in-bool-context]
  indices = (TypeList*) BroType::Unserialize(info, TYPE_LIST);
                                                            ^
/home/johanna/bro/master/src/Type.cc: In member function 'virtual bool FuncType::DoUnserialize(UnserialInfo*)':
/home/johanna/bro/master/src/Type.cc:868:61: warning: enum constant in boolean context [-Wint-in-bool-context]
  args = (RecordType*) BroType::Unserialize(info, TYPE_RECORD);
                                                             ^
/home/johanna/bro/master/src/Type.cc:872:62: warning: enum constant in boolean context [-Wint-in-bool-context]
  arg_types = (TypeList*) BroType::Unserialize(info, TYPE_LIST);

This one is a really nice catch in my opinion. GCC is completely correct
- the 2nd argument to Unserialize is a bool. This means that all these
calls always evaluate to Unserialize(info, true). Which is equivalent
with the default, so I just removed the type from the call.

This was probably caused by someone thinking of BroVal::Unserialize,
which needs the type as the 2nd argument.
This commit is contained in:
Johanna Amann 2017-12-05 11:30:06 -08:00
parent 7c03f4dec0
commit bfe94641cf

View file

@ -545,7 +545,7 @@ bool IndexType::DoUnserialize(UnserialInfo* info)
DO_UNSERIALIZE(BroType); DO_UNSERIALIZE(BroType);
UNSERIALIZE_OPTIONAL(yield_type, BroType::Unserialize(info)); UNSERIALIZE_OPTIONAL(yield_type, BroType::Unserialize(info));
indices = (TypeList*) BroType::Unserialize(info, TYPE_LIST); indices = (TypeList*) BroType::Unserialize(info);
return indices != 0; return indices != 0;
} }
@ -865,11 +865,11 @@ bool FuncType::DoUnserialize(UnserialInfo* info)
UNSERIALIZE_OPTIONAL(yield, BroType::Unserialize(info)); UNSERIALIZE_OPTIONAL(yield, BroType::Unserialize(info));
args = (RecordType*) BroType::Unserialize(info, TYPE_RECORD); args = (RecordType*) BroType::Unserialize(info);
if ( ! args ) if ( ! args )
return false; return false;
arg_types = (TypeList*) BroType::Unserialize(info, TYPE_LIST); arg_types = (TypeList*) BroType::Unserialize(info);
if ( ! arg_types ) if ( ! arg_types )
return false; return false;