Commit 4f998266 authored by Serge Martin's avatar Serge Martin Committed by Marge Bot
Browse files

clover: avoid adding an extra space to compiler options



This make CTS test_compiler happier
Reviewed-by: Francisco Jerez's avatarFrancisco Jerez <currojerez@riseup.net>
Part-of: <!4974>
parent 811b17a2
......@@ -29,6 +29,15 @@
using namespace clover;
namespace {
std::string
build_options(const char *p_opts, const char *p_debug) {
auto opts = std::string(p_opts ? p_opts : "");
std::string extra_opts = debug_get_option(p_debug, "");
return detokenize(std::vector<std::string>{opts, extra_opts}, " ");
}
class build_notifier {
public:
build_notifier(cl_program prog,
......@@ -195,8 +204,7 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
auto &prog = obj(d_prog);
auto devs =
(d_devs ? objs(d_devs, num_devs) : ref_vector<device>(prog.devices()));
const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_BUILD_OPTIONS", "");
const auto opts = build_options(p_opts, "CLOVER_EXTRA_BUILD_OPTIONS");
validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
......@@ -230,8 +238,7 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
auto &prog = obj(d_prog);
auto devs =
(d_devs ? objs(d_devs, num_devs) : ref_vector<device>(prog.devices()));
const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_COMPILE_OPTIONS", "");
const auto opts = build_options(p_opts, "CLOVER_EXTRA_COMPILE_OPTIONS");
header_map headers;
validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
......@@ -354,8 +361,7 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
void (*pfn_notify) (cl_program, void *), void *user_data,
cl_int *r_errcode) try {
auto &ctx = obj(d_ctx);
const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_LINK_OPTIONS", "");
const auto opts = build_options(p_opts, "CLOVER_EXTRA_LINK_OPTIONS");
auto progs = objs(d_progs, num_progs);
auto all_devs =
(d_devs ? objs(d_devs, num_devs) : ref_vector<device>(ctx.devices()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment