Package: opencl-headers
Version: 1.2-2012.04.18a-1
Followup-For: Bug #684444

  Hi,

  I've been hit by this bug, too. Would you accept a patch to solve it?
Here is such a patch in attachment.

This allows to compile the first and second program and it emits
an error for the third one explaining the problem:
vdanjean@eyak:/tmp$ cat toto.cpp 
#include <CL/cl.hpp>
vdanjean@eyak:/tmp$ cat toto2.cpp 
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#include <CL/opencl.h>
#include <CL/cl.hpp>
vdanjean@eyak:/tmp$ cat toto3.cpp 
#include <CL/opencl.h>
#include <CL/cl.hpp>
vdanjean@eyak:/tmp$ 

vdanjean@eyak:/tmp$ g++ -Wall -c toto.cpp 
In file included from /usr/include/CL/opencl.h:43:0,
                 from /usr/include/CL/cl.hpp:175,
                 from toto.cpp:1:
/usr/include/CL/cl_gl.h:107:2: warning: #warning 
CL_USE_DEPRECATED_OPENCL_1_1_APIS is defined. These APIs are unsupported and 
untested in OpenCL 1.2! [-Wcpp]
vdanjean@eyak:/tmp$ g++ -Wall -c toto2.cpp 
In file included from /usr/include/CL/opencl.h:43:0,
                 from toto2.cpp:2:
/usr/include/CL/cl_gl.h:107:2: warning: #warning 
CL_USE_DEPRECATED_OPENCL_1_1_APIS is defined. These APIs are unsupported and 
untested in OpenCL 1.2! [-Wcpp]
vdanjean@eyak:/tmp$ g++ -Wall -c toto3.cpp 
In file included from toto3.cpp:2:0:
/usr/include/CL/cl.hpp:183:4: error: #error some OpenCL headers have already 
been included without CL_USE_DEPRECATED_OPENCL_1_1_APIS defined
In file included from toto3.cpp:2:0:
/usr/include/CL/cl.hpp: In function ‘cl_int cl::UnloadCompiler()’:
/usr/include/CL/cl.hpp:1627:12: error: ‘::clUnloadCompiler’ has not been 
declared
/usr/include/CL/cl.hpp: In constructor ‘cl::Image2D::Image2D(const 
cl::Context&, cl_mem_flags, cl::ImageFormat, size_t, size_t, size_t, void*, 
cl_int*)’:
/usr/include/CL/cl.hpp:2386:19: error: ‘::clCreateImage2D’ has not been declared
/usr/include/CL/cl.hpp: In constructor ‘cl::Image2DGL::Image2DGL(const 
cl::Context&, cl_mem_flags, GLenum, GLint, GLuint, cl_int*)’:
/usr/include/CL/cl.hpp:2431:19: error: ‘::clCreateFromGLTexture2D’ has not been 
declared
/usr/include/CL/cl.hpp: In constructor ‘cl::Image3D::Image3D(const 
cl::Context&, cl_mem_flags, cl::ImageFormat, size_t, size_t, size_t, size_t, 
size_t, void*, cl_int*)’:
/usr/include/CL/cl.hpp:2485:19: error: ‘::clCreateImage3D’ has not been declared
/usr/include/CL/cl.hpp: In constructor ‘cl::Image3DGL::Image3DGL(const 
cl::Context&, cl_mem_flags, GLenum, GLint, GLuint, cl_int*)’:
/usr/include/CL/cl.hpp:2531:19: error: ‘::clCreateFromGLTexture3D’ has not been 
declared
/usr/include/CL/cl.hpp: In member function ‘cl_int 
cl::CommandQueue::enqueueMarker(cl::Event*) const’:
/usr/include/CL/cl.hpp:3766:13: error: ‘::clEnqueueMarker’ has not been declared
/usr/include/CL/cl.hpp: In member function ‘cl_int 
cl::CommandQueue::enqueueWaitForEvents(const std::vector<cl::Event>&) const’:
/usr/include/CL/cl.hpp:3773:13: error: ‘::clEnqueueWaitForEvents’ has not been 
declared
/usr/include/CL/cl.hpp: In member function ‘cl_int 
cl::CommandQueue::enqueueBarrier() const’:
/usr/include/CL/cl.hpp:3888:13: error: ‘::clEnqueueBarrier’ has not been 
declared
vdanjean@eyak:/tmp$ 

  Regards,
    Vincent

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386 armel mipsel

Kernel: Linux 3.2.0-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- no debconf information
--- cl.hpp.orig	2012-08-29 17:16:34.903025550 +0200
+++ cl.hpp	2012-08-29 17:40:23.763928115 +0200
@@ -140,6 +140,17 @@
 #ifndef CL_HPP_
 #define CL_HPP_
 
+/* This is a OpenCL 1.1 header but other headers are 1.2
+   so we must define CL_USE_DEPRECATED_OPENCL_1_1_APIS
+   and check that other headers have not already been
+   included without this define
+ */
+#if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) \
+  && (defined(__OPENCL_CL_H) || defined (__OPENCL_CL_GL_H))
+# define __CL_USE_DEPRECATED_OPENCL_1_1_APIS_WAS_NOT_DEFINED_BUT_HEADERS_INCLUDED
+#endif
+#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
+
 #ifdef _WIN32
 #include <windows.h>
 #include <malloc.h>
@@ -164,6 +175,16 @@
 #include <CL/opencl.h>
 #endif // !__APPLE__
 
+#ifdef __CL_USE_DEPRECATED_OPENCL_1_1_APIS_WAS_NOT_DEFINED_BUT_HEADERS_INCLUDED
+  /* Now, we can check if previously included headers was 1.2 headers.
+     1.1 headers would perfectly works with this header.
+  */
+# if defined(CL_VERSION_1_2)
+#  error some OpenCL headers have already been included without CL_USE_DEPRECATED_OPENCL_1_1_APIS defined
+# endif
+# undef __CL_USE_DEPRECATED_OPENCL_1_1_APIS_WAS_NOT_DEFINED_BUT_HEADERS_INCLUDED
+#endif
+
 #if !defined(CL_CALLBACK)
 #define CL_CALLBACK
 #endif //CL_CALLBACK

Reply via email to