From bfe94641cf3781293354fd8c80e7307e734be4db Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Tue, 5 Dec 2017 11:30:06 -0800 Subject: [PATCH] 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. --- src/Type.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Type.cc b/src/Type.cc index cce328d92b..aa9388d64e 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -545,7 +545,7 @@ bool IndexType::DoUnserialize(UnserialInfo* info) DO_UNSERIALIZE(BroType); UNSERIALIZE_OPTIONAL(yield_type, BroType::Unserialize(info)); - indices = (TypeList*) BroType::Unserialize(info, TYPE_LIST); + indices = (TypeList*) BroType::Unserialize(info); return indices != 0; } @@ -865,11 +865,11 @@ bool FuncType::DoUnserialize(UnserialInfo* info) UNSERIALIZE_OPTIONAL(yield, BroType::Unserialize(info)); - args = (RecordType*) BroType::Unserialize(info, TYPE_RECORD); + args = (RecordType*) BroType::Unserialize(info); if ( ! args ) return false; - arg_types = (TypeList*) BroType::Unserialize(info, TYPE_LIST); + arg_types = (TypeList*) BroType::Unserialize(info); if ( ! arg_types ) return false;