[Mesa-dev] [PATCH] glcpp: Reject #version after the version has been resolved.

Kenneth Graunke kenneth at whitecape.org
Fri Jan 31 00:53:17 PST 2014


On 01/30/2014 02:24 PM, Carl Worth wrote:
> Matt Turner <mattst88 at gmail.com> writes:
>> +		if (parser->version_resolved) {
>> +			glcpp_error(& @1, parser, "#version after
>> version is resolved");
> 
> The phrasing "after version is resolved" makes a lot of sense from the
> point-of-view of the implementation, but it's not ideal for guiding the
> user to a solution.
> 
> Perhaps better would be something like:
> 
> 	#version must be on first line
> 
> You might come up with better wording, still. I don't know if it's worth
> trying to clarify that comment lines or blank lines can appear before
> #version.
> 
> It would also be possible to distinguish a separate "Duplicate #version"
> error case, but that would require additional state in the parser so is
> likely not worth it. And the "first line" wording should guide the user
> appropriately even if there are duplicate #version directives.
> 
> Regardless of the specific wording finally chosen:
> 
> Reviewed-by: Carl Worth <cworth at cworth.org>
> 
> -Carl

I do agree with Carl - "#version after version is resolved" isn't very
clear for the application author, and that's who these messages are for.

"#version must be on first line" seems pretty clear.  I suppose you
could add "(ignoring comments)" or the like, but either way, it's a
nicer message IMHO.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140131/6f1e2378/attachment.pgp>


More information about the mesa-dev mailing list