Skip to content

Commit 0a8130d

Browse files
committed
DFCC: do not surface confusing warning
Users do not know that DFCC uses generate-function-bodies to ensure sound operation, and indeed the user had everything set up just right when _no_ function needed to be generated. Towards: #8638
1 parent 4a1a325 commit 0a8130d

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/goto-instrument/contracts/dynamic-frames/dfcc.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ void dfcct::transform_goto_model()
518518
std::regex("(?!" CPROVER_PREFIX ").*"),
519519
*generate_implementation,
520520
goto_model,
521-
message_handler);
521+
message_handler,
522+
true);
522523
goto_model.goto_functions.update();
523524

524525
reinitialize_model();

src/goto-instrument/generate_function_bodies.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,14 @@ std::unique_ptr<generate_function_bodiest> generate_function_bodies_factory(
498498
/// \param generate_function_body: Specifies what kind of body to generate
499499
/// \param model: The goto-model in which to generate the function bodies
500500
/// \param message_handler: Destination for status/warning messages
501+
/// \param ignore_no_match: Do not warn in case no function matched
502+
/// \p functions_regex
501503
void generate_function_bodies(
502504
const std::regex &functions_regex,
503505
const generate_function_bodiest &generate_function_body,
504506
goto_modelt &model,
505-
message_handlert &message_handler)
507+
message_handlert &message_handler,
508+
bool ignore_no_match)
506509
{
507510
messaget messages(message_handler);
508511
const std::regex cprover_prefix = std::regex("__CPROVER.*");
@@ -526,7 +529,7 @@ void generate_function_bodies(
526529
function.second, model.symbol_table, function.first);
527530
}
528531
}
529-
if(!did_generate_body)
532+
if(!did_generate_body && !ignore_no_match)
530533
{
531534
messages.warning()
532535
<< "generate function bodies: No function name matched regex"

src/goto-instrument/generate_function_bodies.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ void generate_function_bodies(
6868
const std::regex &functions_regex,
6969
const generate_function_bodiest &generate_function_body,
7070
goto_modelt &model,
71-
message_handlert &message_handler);
71+
message_handlert &message_handler,
72+
bool ignore_no_match);
7273

7374
/// Generate a clone of \p function_name (labelled with \p call_site_id) and
7475
/// instantiate its body with selective havocing of its parameters.

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,8 @@ void goto_instrument_parse_optionst::instrument_goto_program()
14001400
std::regex(cmdline.get_value("generate-function-body")),
14011401
*generate_implementation,
14021402
goto_model,
1403-
ui_message_handler);
1403+
ui_message_handler,
1404+
false);
14041405
}
14051406

14061407
if(cmdline.isset("generate-havocing-body"))
@@ -1427,7 +1428,8 @@ void goto_instrument_parse_optionst::instrument_goto_program()
14271428
std::regex(options_split[0]),
14281429
*generate_implementation,
14291430
goto_model,
1430-
ui_message_handler);
1431+
ui_message_handler,
1432+
false);
14311433
}
14321434
else
14331435
{

0 commit comments

Comments
 (0)