From: Francisco Jerez Date: Fri, 19 Oct 2012 09:29:40 +0000 (+0200) Subject: clover: No need for clover::is_zero() to be a functor. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26fc30ef83a9b1bb3d7379e7816e1f1eaafd6fb3;p=mesa.git clover: No need for clover::is_zero() to be a functor. Simplify is_zero() somewhat, and as a side effect work around a gcc compiler bug that causes build failure. https://bugs.freedesktop.org/show_bug.cgi?id=56140 Reported-by: Dmitry Cherkassov --- diff --git a/src/gallium/state_trackers/clover/api/context.cpp b/src/gallium/state_trackers/clover/api/context.cpp index c8d668933e5..80afb6bf4ec 100644 --- a/src/gallium/state_trackers/clover/api/context.cpp +++ b/src/gallium/state_trackers/clover/api/context.cpp @@ -37,7 +37,7 @@ clCreateContext(const cl_context_properties *props, cl_uint num_devs, (!pfn_notify && user_data)) throw error(CL_INVALID_VALUE); - if (any_of(is_zero(), devs, devs + num_devs)) + if (any_of(is_zero, devs, devs + num_devs)) throw error(CL_INVALID_DEVICE); for (auto p : mprops) { diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp index 775f251e076..9e371fdbc55 100644 --- a/src/gallium/state_trackers/clover/api/kernel.cpp +++ b/src/gallium/state_trackers/clover/api/kernel.cpp @@ -206,7 +206,7 @@ namespace { throw error(CL_INVALID_CONTEXT); if (bool(num_deps) != bool(deps) || - any_of(is_zero(), deps, deps + num_deps)) + any_of(is_zero, deps, deps + num_deps)) throw error(CL_INVALID_EVENT_WAIT_LIST); if (any_of([](std::unique_ptr &arg) { @@ -220,7 +220,7 @@ namespace { if (dims < 1 || dims > q->dev.max_block_size().size()) throw error(CL_INVALID_WORK_DIMENSION); - if (!grid_size || any_of(is_zero(), grid_size, grid_size + dims)) + if (!grid_size || any_of(is_zero, grid_size, grid_size + dims)) throw error(CL_INVALID_GLOBAL_WORK_SIZE); if (block_size) { diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index b167904377f..74de840d3df 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -35,7 +35,7 @@ clCreateProgramWithSource(cl_context ctx, cl_uint count, throw error(CL_INVALID_CONTEXT); if (!count || !strings || - any_of(is_zero(), strings, strings + count)) + any_of(is_zero, strings, strings + count)) throw error(CL_INVALID_VALUE); // Concatenate all the provided fragments together diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp index 8ea8f86768b..295d6c7b29e 100644 --- a/src/gallium/state_trackers/clover/api/transfer.cpp +++ b/src/gallium/state_trackers/clover/api/transfer.cpp @@ -40,7 +40,7 @@ namespace { throw error(CL_INVALID_COMMAND_QUEUE); if (bool(num_deps) != bool(deps) || - any_of(is_zero(), deps, deps + num_deps)) + any_of(is_zero, deps, deps + num_deps)) throw error(CL_INVALID_EVENT_WAIT_LIST); if (any_of([&](const cl_event ev) { diff --git a/src/gallium/state_trackers/clover/core/base.hpp b/src/gallium/state_trackers/clover/core/base.hpp index 2a2e26a141a..f487f0fa992 100644 --- a/src/gallium/state_trackers/clover/core/base.hpp +++ b/src/gallium/state_trackers/clover/core/base.hpp @@ -273,11 +273,9 @@ namespace clover { } template - std::function - is_zero() { - return [](const T &x) { - return x == 0; - }; + bool + is_zero(T x) { + return x == 0; } }