@@ -214,70 +214,63 @@ bool read_bin_goto_object(
214
214
{
215
215
messaget message (message_handler);
216
216
217
- {
218
- char hdr[4 ];
219
- hdr[0 ]=static_cast <char >(in.get ());
220
- hdr[1 ]=static_cast <char >(in.get ());
221
- hdr[2 ]=static_cast <char >(in.get ());
217
+ char hdr[4 ];
218
+ hdr[0 ] = static_cast <char >(in.get ());
219
+ hdr[1 ] = static_cast <char >(in.get ());
220
+ hdr[2 ] = static_cast <char >(in.get ());
222
221
223
- if (hdr[0 ]==' G' && hdr[1 ]==' B' && hdr[2 ]==' F' )
222
+ if (hdr[0 ] == ' G' && hdr[1 ] == ' B' && hdr[2 ] == ' F' )
223
+ {
224
+ // OK!
225
+ }
226
+ else
227
+ {
228
+ hdr[3 ] = static_cast <char >(in.get ());
229
+ if (hdr[0 ] == 0x7f && hdr[1 ] == ' G' && hdr[2 ] == ' B' && hdr[3 ] == ' F' )
224
230
{
225
231
// OK!
226
232
}
227
- else
233
+ else if (hdr[ 0 ] == 0x7f && hdr[ 1 ] == ' E ' && hdr[ 2 ] == ' L ' && hdr[ 3 ] == ' F ' )
228
234
{
229
- hdr[3 ]=static_cast <char >(in.get ());
230
- if (hdr[0 ]==0x7f && hdr[1 ]==' G' && hdr[2 ]==' B' && hdr[3 ]==' F' )
231
- {
232
- // OK!
233
- }
234
- else if (hdr[0 ]==0x7f && hdr[1 ]==' E' && hdr[2 ]==' L' && hdr[3 ]==' F' )
235
- {
236
- if (!filename.empty ())
237
- message.error () << " Sorry, but I can't read ELF binary '" << filename
238
- << " '" << messaget::eom;
239
- else
240
- message.error () << " Sorry, but I can't read ELF binaries"
241
- << messaget::eom;
242
-
243
- return true ;
244
- }
235
+ if (!filename.empty ())
236
+ message.error () << " Sorry, but I can't read ELF binary '" << filename
237
+ << " '" << messaget::eom;
245
238
else
246
- {
247
- message.error () << " '" << filename << " ' is not a goto-binary"
239
+ message.error () << " Sorry, but I can't read ELF binaries"
248
240
<< messaget::eom;
249
- return true ;
250
- }
251
- }
252
- }
253
-
254
- irep_serializationt::ireps_containert ic;
255
- irep_serializationt irepconverter (ic);
256
- // symbol_serializationt symbolconverter(ic);
257
241
258
- {
259
- const std::size_t version = irepconverter.read_gb_word (in);
260
-
261
- if (version < GOTO_BINARY_VERSION)
262
- {
263
- message.error () <<
264
- " The input was compiled with an old version of "
265
- " goto-cc; please recompile" << messaget::eom;
266
242
return true ;
267
243
}
268
- else if (version == GOTO_BINARY_VERSION)
269
- {
270
- read_bin_goto_object (in, symbol_table, functions, irepconverter);
271
- return false ;
272
- }
273
244
else
274
245
{
275
- message.error () <<
276
- " The input was compiled with an unsupported version of "
277
- " goto-cc; please recompile" << messaget::eom;
246
+ message.error () << " '" << filename << " ' is not a goto-binary"
247
+ << messaget::eom;
278
248
return true ;
279
249
}
280
250
}
281
251
282
- UNREACHABLE;
252
+ irep_serializationt::ireps_containert ic;
253
+ irep_serializationt irepconverter (ic);
254
+
255
+ const std::size_t version = irepconverter.read_gb_word (in);
256
+
257
+ if (version < GOTO_BINARY_VERSION)
258
+ {
259
+ message.error () << " The input was compiled with an old version of "
260
+ " goto-cc; please recompile"
261
+ << messaget::eom;
262
+ return true ;
263
+ }
264
+ else if (version == GOTO_BINARY_VERSION)
265
+ {
266
+ read_bin_goto_object (in, symbol_table, functions, irepconverter);
267
+ return false ;
268
+ }
269
+ else
270
+ {
271
+ message.error () << " The input was compiled with an unsupported version of "
272
+ " goto-cc; please recompile"
273
+ << messaget::eom;
274
+ return true ;
275
+ }
283
276
}
0 commit comments