Skip to content

Commit d7121f2

Browse files
committed
dump-c: fix support of use-system-headers
As two code branches developed independently, the support for "use-system-headers" was not fully incorporated in b7d828b. This commit re-adds this support for dump-c. Also fixes the known system headers, which include errno.h, but not errno.c and neither noop.c.
1 parent eb5ec24 commit d7121f2

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/goto-instrument/dump_c_class.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ class dump_ct
3535
copied_symbol_table(_ns.get_symbol_table()),
3636
ns(copied_symbol_table),
3737
language(factory()),
38-
harness(include_harness)
38+
harness(include_harness),
39+
system_symbols(use_system_headers)
3940
{
40-
if(use_system_headers)
41-
system_symbols=system_library_symbolst();
4241
system_symbols.set_use_all_headers(use_all_headers);
4342
}
4443

src/goto-programs/system_library_symbols.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ Author: Thomas Kiley
1717
#include <util/type.h>
1818
#include <sstream>
1919

20-
system_library_symbolst::system_library_symbolst():
20+
system_library_symbolst::system_library_symbolst(bool init):
2121
use_all_headers(false)
2222
{
23-
init_system_library_map();
23+
if(init)
24+
init_system_library_map();
2425
}
2526

2627
/// To generate a map of header file names -> list of symbols The symbol names
@@ -220,13 +221,7 @@ void system_library_symbolst::init_system_library_map()
220221
{
221222
"__error", "__errno_location", "__errno"
222223
};
223-
add_to_system_library("errno.c", errno_syms);
224-
225-
std::list<irep_idt> noop_syms=
226-
{
227-
"__noop"
228-
};
229-
add_to_system_library("noop.c", noop_syms);
224+
add_to_system_library("errno.h", errno_syms);
230225

231226
#if 0
232227
// sys/types.h

src/goto-programs/system_library_symbols.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Author: Thomas Kiley
1313
#define CPROVER_GOTO_PROGRAMS_SYSTEM_LIBRARY_SYMBOLS_H
1414

1515
#include <list>
16+
#include <map>
1617
#include <set>
1718
#include <string>
1819
#include <util/irep.h>
@@ -24,7 +25,12 @@ class typet;
2425
class system_library_symbolst
2526
{
2627
public:
27-
system_library_symbolst();
28+
explicit system_library_symbolst(bool init);
29+
30+
system_library_symbolst():
31+
system_library_symbolst(true) // NOLINT(runtime/explicit)
32+
{
33+
}
2834

2935
bool is_symbol_internal_symbol(
3036
const symbolt &symbol,

0 commit comments

Comments
 (0)