Skip to content

remove two fields from goto-binary function format #3113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified regression/ansi-c/arch_flags_mcpu_bad/object.intel
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mcpu_good/object.arm
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mthumb_bad/object.intel
Binary file not shown.
Binary file modified regression/ansi-c/arch_flags_mthumb_good/object.arm
Binary file not shown.
Binary file removed regression/goto-diff/syntactic-diff1/a.gb
Binary file not shown.
Binary file removed regression/goto-diff/syntactic-diff1/b.gb
Binary file not shown.
4 changes: 2 additions & 2 deletions regression/goto-diff/syntactic-diff1/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CORE
b.gb
a.gb
b.c
a.c
// Enable multi-line checking
activate-multi-line-match
EXIT=0
Expand Down
11 changes: 5 additions & 6 deletions src/goto-programs/read_bin_goto_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Date: June 2006

#include "goto_functions.h"

/// read goto binary format v4
/// read goto binary format v5
/// \par parameters: input stream, symbol_table, functions
/// \return true on error, false otherwise
static bool read_bin_goto_object_v4(
static bool read_bin_goto_object_v5(
std::istream &in,
symbol_tablet &symbol_table,
goto_functionst &functions,
Expand Down Expand Up @@ -100,13 +100,11 @@ static bool read_bin_goto_object_v4(
goto_programt::instructiont &instruction=*itarget;

irepconverter.reference_convert(in, instruction.code);
irepconverter.read_string_ref(in); // former function
irepconverter.reference_convert(in, instruction.source_location);
instruction.type = (goto_program_instruction_typet)
irepconverter.read_gb_word(in);
instruction.guard.make_nil();
irepconverter.reference_convert(in, instruction.guard);
irepconverter.read_string_ref(in); // former event
instruction.target_number = irepconverter.read_gb_word(in);
if(instruction.is_target() &&
rev_target_map.insert(
Expand Down Expand Up @@ -225,13 +223,14 @@ bool read_bin_goto_object(
case 1:
case 2:
case 3:
case 4:
message.error() <<
"The input was compiled with an old version of "
"goto-cc; please recompile" << messaget::eom;
return true;

case 4:
return read_bin_goto_object_v4(
case 5:
return read_bin_goto_object_v5(
in, symbol_table, functions, irepconverter);
break;

Expand Down
17 changes: 7 additions & 10 deletions src/goto-programs/write_goto_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Author: CM Wintersteiger

#include <goto-programs/goto_model.h>

/// Writes a goto program to disc, using goto binary format ver 4
bool write_goto_binary_v4(
/// Writes a goto program to disc, using goto binary format ver 5
bool write_goto_binary_v5(
std::ostream &out,
const symbol_tablet &symbol_table,
const goto_functionst &goto_functions,
Expand Down Expand Up @@ -97,11 +97,9 @@ bool write_goto_binary_v4(
const goto_programt::instructiont &instruction = *i_it;

irepconverter.reference_convert(instruction.code, out);
irepconverter.write_string_ref(out, fct.first);
irepconverter.reference_convert(instruction.source_location, out);
write_gb_word(out, (long)instruction.type);
irepconverter.reference_convert(instruction.guard, out);
irepconverter.write_string_ref(out, irep_idt()); // former event
write_gb_word(out, instruction.target_number);

write_gb_word(out, instruction.targets.size());
Expand Down Expand Up @@ -150,17 +148,16 @@ bool write_goto_binary(
irep_serializationt::ireps_containert irepc;
irep_serializationt irepconverter(irepc);

const int current_goto_version = 4;
if(version < current_goto_version)
if(version < GOTO_BINARY_VERSION)
throw invalid_command_line_argument_exceptiont(
"version " + std::to_string(version) + " no longer supported",
"supported version = " + std::to_string(current_goto_version));
else if(version > current_goto_version)
"supported version = " + std::to_string(GOTO_BINARY_VERSION));
else if(version > GOTO_BINARY_VERSION)
throw invalid_command_line_argument_exceptiont(
"unknown goto binary version " + std::to_string(version),
"supported version = " + std::to_string(current_goto_version));
"supported version = " + std::to_string(GOTO_BINARY_VERSION));
else
return write_goto_binary_v4(
return write_goto_binary_v5(
out, symbol_table, goto_functions, irepconverter);
}

Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/write_goto_binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Author: CM Wintersteiger
#ifndef CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H
#define CPROVER_GOTO_PROGRAMS_WRITE_GOTO_BINARY_H

#define GOTO_BINARY_VERSION 4
#define GOTO_BINARY_VERSION 5

#include <iosfwd>
#include <string>
Expand Down