Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11/X.h macro replaces 'None' #169

Open
ODON1 opened this issue Dec 9, 2021 · 1 comment
Open

X11/X.h macro replaces 'None' #169

ODON1 opened this issue Dec 9, 2021 · 1 comment

Comments

@ODON1
Copy link

ODON1 commented Dec 9, 2021

Depending on the order of includes I get the following error:

In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.cpp:1:
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.h:20:
/usr/local/include/CL/opencl.hpp:7101:5: error: expected identifier
    None = 0,
    ^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None                 0L /* universal null resource or null atom */
                             ^
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.cpp:1:
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.h:20:
/usr/local/include/CL/opencl.hpp:8852:5: error: expected identifier
    None = 0,
    ^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None                 0L /* universal null resource or null atom */
                             ^
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.cpp:1:
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.h:20:
/usr/local/include/CL/opencl.hpp:8902:67: error: expected unqualified-id
        DeviceQueueProperties properties = DeviceQueueProperties::None,
                                                                  ^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None                 0L /* universal null resource or null atom */
                             ^
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.cpp:1:
In file included from /home/otto/Documents/Programming/Interop/tests/testOpenCL.h:20:
/usr/local/include/CL/opencl.hpp:8927:67: error: expected unqualified-id
        DeviceQueueProperties properties = DeviceQueueProperties::None,
                                                                  ^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None                 0L /* universal null resource or null atom */
                             ^

I saw a mention of the same problem here [(https://bugs.webkit.org/show_bug.cgi?id=200984)]

/usr/include/X11/X.h has the following lines:

*****************************************************************
 * RESERVED RESOURCE AND CONSTANT DEFINITIONS
 *****************************************************************/

#ifndef None
#define None                 0L	/* universal null resource or null atom */
#endif

#define ParentRelative       1L	/* background pixmap in CreateWindow
				    and ChangeWindowAttributes */

#define CopyFromParent       0L	/* border pixmap in CreateWindow
				       and ChangeWindowAttributes
				   special VisualID and special window
				       class passed to CreateWindow */

This 'None' macro is apparently still active when processing opencl.hpp and replaces some enums.

(Maybe this should be solved by X11?)

I solved it by adding "#undef None" to the head of the opencl.hpp file but that may not be the best solution

@MathiasMagnus
Copy link
Contributor

@ODON1 Indeed, that error came up a long time ago and was not caught by CI at the time. Changing the name of that enum entry is a breaking change and one we should investigate. This workaround had to be baked into the recently released OpenCL-SDK samples too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants