Skip to content

SSS: Make _start optional #586

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
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
11 changes: 8 additions & 3 deletions src/ansi-c/ansi_c_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ Function: ansi_c_languaget::final

\*******************************************************************/

bool ansi_c_languaget::final(symbol_tablet &symbol_table)
bool ansi_c_languaget::final(
symbol_tablet &symbol_table,
bool generate_start_function)
{
if(ansi_c_entry_point(symbol_table, "main", get_message_handler()))
return true;
if(generate_start_function)
{
if(ansi_c_entry_point(symbol_table, "main", get_message_handler()))
return true;
}

return false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ansi-c/ansi_c_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class ansi_c_languaget:public languaget
const std::string &module) override;

bool final(
symbol_tablet &symbol_table) override;
symbol_tablet &symbol_table,
bool generate_start_function) override;

void show_parse(std::ostream &out) override;

Expand Down
11 changes: 8 additions & 3 deletions src/cpp/cpp_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,15 @@ Function: cpp_languaget::final

\*******************************************************************/

bool cpp_languaget::final(symbol_tablet &symbol_table)
bool cpp_languaget::final(
symbol_tablet &symbol_table,
bool generate_start_function)
{
if(ansi_c_entry_point(symbol_table, "main", get_message_handler()))
return true;
if(generate_start_function)
{
if(ansi_c_entry_point(symbol_table, "main", get_message_handler()))
return true;
}

return false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/cpp/cpp_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class cpp_languaget:public languaget
class replace_symbolt &replace_symbol) const;

bool final(
symbol_tablet &symbol_table) override;
symbol_tablet &symbol_table,
bool generate_start_function) override;

void show_parse(std::ostream &out) override;

Expand Down
2 changes: 1 addition & 1 deletion src/goto-programs/get_goto_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool get_goto_modelt::operator()(const std::vector<std::string> &files)

if(binaries.empty())
{
if(language_files.final(symbol_table))
if(language_files.final(symbol_table, generate_start_function))
{
error() << "CONVERSION ERROR" << eom;
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/goto-programs/get_goto_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Author: Daniel Kroening, [email protected]
class get_goto_modelt:public goto_modelt, public messaget
{
public:
get_goto_modelt() : generate_start_function(true) {}
bool operator()(const std::vector<std::string> &);
bool generate_start_function;
};

#endif // CPROVER_GOTO_PROGRAMS_GET_GOTO_MODEL_H
6 changes: 5 additions & 1 deletion src/java_bytecode/java_bytecode_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,17 @@ Function: java_bytecode_languaget::final

\*******************************************************************/

bool java_bytecode_languaget::final(symbol_tablet &symbol_table)
bool java_bytecode_languaget::final(
symbol_tablet &symbol_table,
bool generate_start_function)
{
/*
if(c_final(symbol_table, message_handler)) return true;
*/
java_internal_additions(symbol_table);

if(!generate_start_function)
return false;

main_function_resultt res=
get_main_symbol(symbol_table, main_class, get_message_handler());
Expand Down
3 changes: 2 additions & 1 deletion src/java_bytecode/java_bytecode_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class java_bytecode_languaget:public languaget
const std::string &module) override;

bool final(
symbol_tablet &context) override;
symbol_tablet &context,
bool generate_start_function) override;

void show_parse(std::ostream &out) override;

Expand Down
15 changes: 10 additions & 5 deletions src/jsil/jsil_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,17 @@ Function: jsil_languaget::final

\*******************************************************************/

bool jsil_languaget::final(symbol_tablet &symbol_table)
bool jsil_languaget::final(
symbol_tablet &symbol_table,
bool generate_start_function)
{
if(jsil_entry_point(
symbol_table,
get_message_handler()))
return true;
if(generate_start_function)
{
if(jsil_entry_point(
symbol_table,
get_message_handler()))
return true;
}

return false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/jsil/jsil_language.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class jsil_languaget:public languaget
const std::string &module);

virtual bool final(
symbol_tablet &context);
symbol_tablet &context,
bool generate_start_function);

virtual void show_parse(std::ostream &out);

Expand Down
5 changes: 3 additions & 2 deletions src/langapi/language_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ language_uit::language_uit(
const cmdlinet &__cmdline,
ui_message_handlert &_ui_message_handler):
ui_message_handler(_ui_message_handler),
_cmdline(__cmdline)
_cmdline(__cmdline),
generate_start_function(true)
{
set_message_handler(ui_message_handler);
}
Expand Down Expand Up @@ -183,7 +184,7 @@ bool language_uit::final()
{
language_files.set_message_handler(*message_handler);

if(language_files.final(symbol_table))
if(language_files.final(symbol_table, generate_start_function))
{
if(get_ui()==ui_message_handlert::PLAIN)
std::cerr << "CONVERSION ERROR" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions src/langapi/language_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class language_uit:public messaget

protected:
const cmdlinet &_cmdline;
bool generate_start_function;
};

#endif // CPROVER_LANGAPI_LANGUAGE_UI_H
2 changes: 1 addition & 1 deletion src/util/language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Function: languaget::final

\*******************************************************************/

bool languaget::final(symbol_tablet &symbol_table)
bool languaget::final(symbol_tablet &symbol_table, bool generate_start_function)
{
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/util/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class languaget:public messaget
// final adjustments, e.g., initialization and call to main()

virtual bool final(
symbol_tablet &symbol_table);
symbol_tablet &symbol_table,
bool generate_start_function);

// type check interfaces of currently parsed file

Expand Down
5 changes: 3 additions & 2 deletions src/util/language_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,16 @@ Function: language_filest::final
\*******************************************************************/

bool language_filest::final(
symbol_tablet &symbol_table)
symbol_tablet &symbol_table,
bool generate_start_function)
{
std::set<std::string> languages;

for(file_mapt::iterator it=file_map.begin();
it!=file_map.end(); it++)
{
if(languages.insert(it->second.language->id()).second)
if(it->second.language->final(symbol_table))
if(it->second.language->final(symbol_table, generate_start_function))
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/language_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class language_filest:public messaget

bool typecheck(symbol_tablet &symbol_table);

bool final(symbol_tablet &symbol_table);
bool final(symbol_tablet &symbol_table, bool generate_start_function);

bool interfaces(symbol_tablet &symbol_table);

Expand Down