From 4f9982669118c927175eac2c56cb19cb48eb7323 Mon Sep 17 00:00:00 2001 From: Serge Martin Date: Sun, 21 Jun 2020 17:08:51 +0200 Subject: [PATCH] clover: avoid adding an extra space to compiler options This make CTS test_compiler happier Reviewed-by: Francisco Jerez Part-of: --- src/gallium/frontends/clover/api/program.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/frontends/clover/api/program.cpp b/src/gallium/frontends/clover/api/program.cpp index 5d4d46a..22c1870 100644 --- a/src/gallium/frontends/clover/api/program.cpp +++ b/src/gallium/frontends/clover/api/program.cpp @@ -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{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(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(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(ctx.devices())); -- 2.7.4