Skip to content

Commit 7e52e22

Browse files
Always allow the main function not to have a body
1 parent c938b08 commit 7e52e22

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

src/java_bytecode/ci_lazy_methods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool ci_lazy_methodst::operator()(
7373
std::vector<irep_idt> method_worklist2;
7474

7575
main_function_resultt main_function =
76-
get_main_symbol(symbol_table, main_class, get_message_handler(), true);
76+
get_main_symbol(symbol_table, main_class, get_message_handler());
7777
if(!main_function.is_success())
7878
{
7979
// Failed, mark all functions in the given main class(es)

src/java_bytecode/java_entry_point.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@ void java_record_outputs(
321321
main_function_resultt get_main_symbol(
322322
const symbol_table_baset &symbol_table,
323323
const irep_idt &main_class,
324-
message_handlert &message_handler,
325-
bool allow_no_body)
324+
message_handlert &message_handler)
326325
{
327326
messaget message(message_handler);
328327

@@ -348,14 +347,6 @@ main_function_resultt get_main_symbol(
348347
symbol != nullptr,
349348
"resolve_friendly_method_name should return a symbol-table identifier");
350349

351-
// check if it has a body
352-
if(symbol->value.is_nil() && !allow_no_body)
353-
{
354-
message.error()
355-
<< "main method `" << main_class << "' has no body" << messaget::eom;
356-
return main_function_resultt::Error;
357-
}
358-
359350
return *symbol; // Return found function
360351
}
361352
else
@@ -395,18 +386,7 @@ main_function_resultt get_main_symbol(
395386
return main_function_resultt::Error; // give up with error, no main
396387
}
397388

398-
// function symbol
399-
const symbolt &symbol = **matches.begin();
400-
401-
// check if it has a body
402-
if(symbol.value.is_nil() && !allow_no_body)
403-
{
404-
message.error()
405-
<< "main method `" << main_class << "' has no body" << messaget::eom;
406-
return main_function_resultt::Error; // give up with error
407-
}
408-
409-
return symbol; // Return found function
389+
return **matches.begin(); // Return found function
410390
}
411391
}
412392

@@ -464,7 +444,6 @@ bool java_entry_point(
464444
return true;
465445
symbolt symbol=res.main_function;
466446

467-
assert(!symbol.value.is_nil());
468447
assert(symbol.type.id()==ID_code);
469448

470449
create_initialize(symbol_table);

src/java_bytecode/java_entry_point.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ struct main_function_resultt
6363
main_function_resultt get_main_symbol(
6464
const symbol_table_baset &symbol_table,
6565
const irep_idt &main_class,
66-
message_handlert &,
67-
bool allow_no_body = false);
66+
message_handlert &);
6867

6968
bool generate_java_start_function(
7069
const symbolt &symbol,

0 commit comments

Comments
 (0)