[Mesa-dev] [PATCH] clover: Pass unquoted compiler arguments to Clang

Francisco Jerez currojerez at riseup.net
Mon Jun 6 00:04:05 UTC 2016


Vedran Miletić <vedran at miletic.net> writes:

> On 06/04/2016 10:13 AM, Francisco Jerez wrote:
>> Vedran Miletić <vedran at miletic.net> writes:
>>
>>> OpenCL apps can quote arguments they pass to the OpenCL compiler, most
>>> commonly include paths containing spaces. If the OpenCL compiler was
>>> called via a shell, the shell would remove (single or double) quotes
>>> before passing the argument to the compiler. Since we call Clang as a
>>> library, we have to remove quotes before passing the argument.
>>
>> Sigh, it's a shame that the OpenCL spec doesn't specify what format the
>> option string should have, whether quotes have any special
>> interpretation at all, whether escape sequences are supported, etc.
>> Might be worth reporting the problem at Khronos -- Or have you found any
>> evidence in the spec that the parsing logic you implement below is the
>> correct one?
>>
>
> Aside from working just like NVIDIA and AMD proprietary stacks, no.
>
> However, what we do right now is most certainly broken. Consider the 
> following argument
>
> -I"/foo bar/baz"
>
> which is going to be sent to Clang as two arguments broken over space, 
> while it should be one.

But the OpenCL spec doesn't impose any explicit requirements on the
formatting of the option string (unless I'm missing something), so
strictly speaking both interpretations are equally broken.  It wasn't my
intention to argue against implementing the same behaviour as the
proprietary CL stacks as temporary solution, but the fact that this is
unspecified is certainly an OpenCL spec bug.

> We should split arguments correctly, and whether or not we remove
> quotes in the process or we expect Clang to handle them is the easier
> part of the job.
>
> Regards,
> Vedran
>
> -- 
> Vedran Miletić
> vedran.miletic.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160605/e2ccfa2b/attachment.sig>


More information about the mesa-dev mailing list