Skip to content

Commit 27236aa

Browse files
author
martin
committed
Avoid diagnostic code crashing when external front-ends use "C" mode
At the time of writing both the rust and the Ada external front-ends generate .json_symtab files that use the "C" mode. If the ansi-c front-end is not loaded then these will crash when reporting some linking errors.
1 parent 06c563a commit 27236aa

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/symtab2gb/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SRC = \
44
# Empty last line
55

66
OBJ += \
7+
../ansi-c/ansi-c$(LIBEXT) \
78
../util/util$(LIBEXT) \
89
../goto-programs/goto-programs$(LIBEXT) \
910
../big-int/big-int$(LIBEXT) \

src/symtab2gb/symtab2gb_parse_options.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Author: Diffblue Ltd.
1212
#include <iostream>
1313
#include <string>
1414

15+
#include <ansi-c/ansi_c_language.h>
16+
1517
#include <goto-programs/goto_convert_functions.h>
1618
#include <goto-programs/goto_model.h>
1719
#include <goto-programs/link_goto_model.h>
@@ -113,6 +115,8 @@ int symtab2gb_parse_optionst::doit()
113115
gb_filename = cmdline.get_value(SYMTAB2GB_OUT_FILE_OPT);
114116
}
115117
register_language(new_json_symtab_language);
118+
// Workaround to allow external front-ends to use "C" mode
119+
register_language(new_ansi_c_language);
116120
config.set(cmdline);
117121
run_symtab2gb(symtab_filenames, gb_filename);
118122
return CPROVER_EXIT_SUCCESS;

0 commit comments

Comments
 (0)