Skip to content

Commit 1218856

Browse files
pkesseliPascal Kesseli
authored andcommitted
Added optional clang command for CEGIS danger test compilation.
1 parent f1f2fc5 commit 1218856

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cegis/genetic/dynamic_test_runner_helper.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <cassert>
66
#include <fstream>
77

8+
#include <util/config.h>
89
#include <util/tempfile.h>
910

1011
#include <cegis/instrument/literals.h>
@@ -33,6 +34,7 @@ void write_file(const char * const path, const std::string &content)
3334
#define SOURCE_FILE_SUFFIX ".c"
3435
#ifndef _WIN32
3536
#define COMPILE_COMMAND "gcc -std=c99 -g0 -O2 -shared -rdynamic -fPIC "
37+
#define CLANG_COMPILE_COMMAND "clang -std=c99 -g0 -O2 -shared -rdynamic -fPIC "
3638
#else
3739
#define COMPILE_COMMAND "gcc -std=c99 -g0 -O2 -shared "
3840
#endif
@@ -49,7 +51,11 @@ void *prepare_fitness_tester_library(fitness_lib_handlet &handle,
4951
const temporary_filet source_file(SOURCE_FILE_PREFIX, SOURCE_FILE_SUFFIX);
5052
const std::string source_file_name(source_file());
5153
write_file(source_file_name.c_str(), source_code_provider());
52-
std::string compile_command(COMPILE_COMMAND);
54+
std::string compile_command;
55+
if (configt::ansi_ct::preprocessort::PP_CLANG == config.ansi_c.preprocessor)
56+
compile_command+=CLANG_COMPILE_COMMAND;
57+
else
58+
compile_command+=COMPILE_COMMAND;
5359
compile_command+=compile_options;
5460
compile_command+=source_file_name;
5561
compile_command+=ARTIFACT_SEPARATOR;

0 commit comments

Comments
 (0)