Use 0 rather than NULL for the empty command queue property set - #60
Merged
galekseev merged 1 commit intoAug 2, 2026
Merged
Conversation
cl_command_queue_properties is a cl_bitfield (cl_ulong), not a pointer,
so initialising it from NULL relies on the null pointer constant
converting to an integer. gcc flags this under -Wall, which the Makefile
enables:
Dispatcher.cpp:140:41: warning: converting to non-pointer type
'cl_command_queue_properties' {aka 'long unsigned int'} from NULL
[-Wconversion-null]
This was the only -Wconversion-null in the project; both the release and
the PROFANITY_DEBUG build are now clean of it. The emitted object file is
byte-identical, so there is no behavioural change.
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Drive-by cleanup noticed while reviewing #58, on the line directly above the one that PR changed.
Problem
cl_command_queue_propertiesis acl_bitfield, which is acl_ulong. It is not a pointer type, so initialising it fromNULLdepends on the null pointer constant converting to an integer. gcc flags this under-Wall, whichMakefileenables for every build:Beyond the noise,
NULLhere reads as "no properties pointer", which is misleading:pis a bitfield of queue property flags, and the intended value is the empty flag set.Change
This matches the
#ifdefbranch above it, which already assigns a bitfield constant.Verification
Linux, OpenCL 3.0 headers, gcc 13, built with the project's own flags (
-std=c++11 -Wall -O2 -mcmodel=large).-Wconversion-nullin the project. Both the release and the-DPROFANITY_DEBUGbuild now report zero, leaving only the unrelated pre-existing-Waligned-new=note onnew Dispatcher::Device.md5 3e19513d758d567d6c1e15acdbfffbb1either way), so this is a provable no-op at the machine code level.