[Mesa-stable] [PATCH 2/3] glsl-1.30: Expect __ tests to pass

Ian Romanick idr at freedesktop.org
Tue Feb 18 19:18:57 CET 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the
GLSL ES spec (all versions) say:

    "All macro names containing two consecutive underscores ( __ ) are
    reserved for future use as predefined macro names. All macro names
    prefixed with "GL_" ("GL" followed by a single underscore) are also
    reserved."

The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos.  Since every extension adds a name prefixed with GL_ (i.e.,
the name of the extension), that should be an error.  Names simply
containing __ are dangerous to use, but should be allowed.  In similar
cases, the C++ preprocessor specification says, "no diagnostic is
required."

Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: "9.2 10.0 10.1" <mesa-stable at lists.freedesktop.org>
Cc: Tapani Pälli <lemody at gmail.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702
---
 .../glsl-1.30/preprocessor/reserved/double-underscore-01.frag  | 10 +++++++++-
 .../glsl-1.30/preprocessor/reserved/double-underscore-02.frag  | 10 +++++++++-
 .../glsl-1.30/preprocessor/reserved/double-underscore-03.frag  | 10 +++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-01.frag b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-01.frag
index 6c43fc9..38830db 100644
--- a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-01.frag
+++ b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-01.frag
@@ -1,5 +1,5 @@
 // [config]
-// expect_result: fail
+// expect_result: pass
 // glsl_version: 1.30
 // [end config]
 //
@@ -8,6 +8,14 @@
 // From page 11 (17 of pdf) of the GLSL 1.30 spec:
 //     "All macro names containing two consecutive underscores ( __ ) are
 //     reserved for future use as predefined macro names."
+//
+// The intention is that names containing __ are reserved for internal
+// use by the implementation, and names prefixed with GL_ are reserved
+// for use by Khronos.  Since every extension adds a name prefixed
+// with GL_ (i.e., the name of the extension), that should be an
+// error.  Names simply containing __ are dangerous to use, but should
+// be allowed.  In similar cases, the C++ preprocessor specification
+// says, "no diagnostic is required."
 
 #version 130
 #define __I_AM_RESERVED 1
diff --git a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag
index 3837fc5..797a6bf 100644
--- a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag
+++ b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag
@@ -1,5 +1,5 @@
 // [config]
-// expect_result: fail
+// expect_result: pass
 // glsl_version: 1.30
 // [end config]
 //
@@ -8,6 +8,14 @@
 // From page 11 (17 of pdf) of the GLSL 1.30 spec:
 //     "All macro names containing two consecutive underscores ( __ ) are
 //     reserved for future use as predefined macro names."
+//
+// The intention is that names containing __ are reserved for internal
+// use by the implementation, and names prefixed with GL_ are reserved
+// for use by Khronos.  Since every extension adds a name prefixed
+// with GL_ (i.e., the name of the extension), that should be an
+// error.  Names simply containing __ are dangerous to use, but should
+// be allowed.  In similar cases, the C++ preprocessor specification
+// says, "no diagnostic is required."
 
 #version 130
 #define I_AM_RESERVED__ 1
diff --git a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag
index dabda65..505d069 100644
--- a/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag
+++ b/tests/spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag
@@ -1,5 +1,5 @@
 // [config]
-// expect_result: fail
+// expect_result: pass
 // glsl_version: 1.30
 // [end config]
 //
@@ -9,6 +9,14 @@
 // From page 11 (17 of pdf) of the GLSL 1.30 spec:
 //     "All macro names containing two consecutive underscores ( __ ) are
 //     reserved for future use as predefined macro names."
+//
+// The intention is that names containing __ are reserved for internal
+// use by the implementation, and names prefixed with GL_ are reserved
+// for use by Khronos.  Since every extension adds a name prefixed
+// with GL_ (i.e., the name of the extension), that should be an
+// error.  Names simply containing __ are dangerous to use, but should
+// be allowed.  In similar cases, the C++ preprocessor specification
+// says, "no diagnostic is required."
 
 #version 130
 #define I__AM__RESERVED 1
-- 
1.8.1.4



More information about the mesa-stable mailing list