A shader like
#define defined gl_Position
defined = vec4(1.0);
should either file to compile at line 1 or it should "just work." Instead, Mesa produces a fairly obtuse error message:
0:5(2): error: `defined' undeclared
0:5(2): error: value of type vec4 cannot be assigned to variable of type error
Apparently some dEQP test expects '#define defined' and '#undef defined' to just work, but glslang generates an error. See also https://github.com/KhronosGroup/glslang/issues/59. Either way, Mesa's behavior is wrong.
deqp strikes again with completely absurd tests.
I'm relieved, reading the github issue that C/C++ say that 'defined' is not macro name, and that glslang has merged a patch to reject such stupidity.
I posted a patch to disallow this on mesa-dev:
Given that GCC, Clang, and now glslang disallow it, it seems pretty clear what the right behavior ought to be. Nothing good can come from making this work.
Fixed in master:
Author: Kenneth Graunke <email@example.com>
Date: Wed Feb 17 17:15:23 2016 -0800
glcpp: Disallow "defined" as a macro name.
Both GCC and Clang disallow this, and glslang has recently started
disallowing it as well.
Signed-off-by: Kenneth Graunke <firstname.lastname@example.org>
Reviewed-by: Matt Turner <email@example.com>
Reviewed-by: Ian Romanick <firstname.lastname@example.org>
unless of course we have to make #define defined actually work, but hopefully not, because that would be silly and pointless. We can always reopen or something if that happens.
on Feb 24, 2017 at 01:43:42.
(provided by the Example extension).