diff options
author | Francisco Jerez <[email protected]> | 2012-10-19 11:29:40 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2012-10-19 12:38:44 +0200 |
commit | 26fc30ef83a9b1bb3d7379e7816e1f1eaafd6fb3 (patch) | |
tree | fcc8988c8066dc793cf416d1c40de9adaf138237 | |
parent | 6551c4ea3cc21169696920c5f3d3fb0bb8d6e939 (diff) |
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 <[email protected]>
5 files changed, 8 insertions, 10 deletions
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<cl_device_id>(), devs, devs + num_devs)) + if (any_of(is_zero<cl_device_id>, 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<cl_event>(), deps, deps + num_deps)) + any_of(is_zero<cl_event>, deps, deps + num_deps)) throw error(CL_INVALID_EVENT_WAIT_LIST); if (any_of([](std::unique_ptr<kernel::argument> &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<size_t>(), grid_size, grid_size + dims)) + if (!grid_size || any_of(is_zero<size_t>, 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<const char *>(), strings, strings + count)) + any_of(is_zero<const char *>, 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<cl_event>(), deps, deps + num_deps)) + any_of(is_zero<cl_event>, 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<typename T> - std::function<bool (const T &)> - is_zero() { - return [](const T &x) { - return x == 0; - }; + bool + is_zero(T x) { + return x == 0; } } |