Skip to content

Commit 2e10579

Browse files
committed
Replace '#include <stdlib.h>' with declaration of 'calloc' function in klee file
1 parent 31508ef commit 2e10579

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/src/printers/KleePrinter.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ using namespace types;
2424
using printer::KleePrinter;
2525

2626
static const std::string KLEE_GLOBAL_VAR_H = "klee_global_var.h";
27+
static const std::string CALLOC_DECLARATION = "extern\n"
28+
"#ifdef __cplusplus\n"
29+
"\"C\"\n"
30+
"#endif\n"
31+
"void* calloc(size_t num, size_t size);\n";
2732

2833
printer::KleePrinter::KleePrinter(const types::TypesHandler *typesHandler,
2934
std::shared_ptr<BuildDatabase> buildDatabase,
@@ -76,9 +81,8 @@ fs::path KleePrinter::writeTmpKleeFile(
7681
strDeclareVar("int", PrinterUtils::KLEE_PATH_FLAG, "0");
7782
}
7883

79-
strInclude("klee/klee.h");
80-
strInclude("stdlib.h", true);
81-
ss << NL;
84+
strInclude("klee/klee.h") << NL;
85+
ss << CALLOC_DECLARATION << NL;
8286
writeStubsForStructureFields(tests);
8387

8488
writeAccessPrivateMacros(typesHandler, tests, false);

0 commit comments

Comments
 (0)