Merge branch 'master' of https://github.com/KhronosGroup/glslang into master

Change-Id: I0e5c5d12b6509c16a3738a6f8eced144458d25c6
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..dc8a805
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,143 @@
+# Copyright 2017 The Fuchsia Authors
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+static_library("glslang") {
+  cflags_cc = [
+    "-Wno-reorder",
+    "-Wno-inconsistent-missing-override",
+    "-Wno-missing-field-initializers",
+    "-Wno-ignored-qualifiers",
+  ]
+  sources = [
+    "glslang/GenericCodeGen/CodeGen.cpp",
+    "glslang/GenericCodeGen/Link.cpp",
+    "glslang/MachineIndependent/Constant.cpp",
+    "glslang/MachineIndependent/InfoSink.cpp",
+    "glslang/MachineIndependent/Initialize.cpp",
+    "glslang/MachineIndependent/IntermTraverse.cpp",
+    "glslang/MachineIndependent/Intermediate.cpp",
+    "glslang/MachineIndependent/ParseContextBase.cpp",
+    "glslang/MachineIndependent/ParseHelper.cpp",
+    "glslang/MachineIndependent/PoolAlloc.cpp",
+    "glslang/MachineIndependent/RemoveTree.cpp",
+    "glslang/MachineIndependent/Scan.cpp",
+    "glslang/MachineIndependent/ShaderLang.cpp",
+    "glslang/MachineIndependent/SymbolTable.cpp",
+    "glslang/MachineIndependent/Versions.cpp",
+    "glslang/MachineIndependent/glslang_tab.cpp",
+    "glslang/MachineIndependent/intermOut.cpp",
+    "glslang/MachineIndependent/iomapper.cpp",
+    "glslang/MachineIndependent/limits.cpp",
+    "glslang/MachineIndependent/linkValidate.cpp",
+    "glslang/MachineIndependent/parseConst.cpp",
+    "glslang/MachineIndependent/preprocessor/Pp.cpp",
+    "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
+    "glslang/MachineIndependent/preprocessor/PpContext.cpp",
+    "glslang/MachineIndependent/preprocessor/PpMemory.cpp",
+    "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
+    "glslang/MachineIndependent/preprocessor/PpSymbols.cpp",
+    "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
+    "glslang/MachineIndependent/propagateNoContraction.cpp",
+    "glslang/MachineIndependent/reflection.cpp",
+  ]
+  deps = [
+    ":HLSL",
+    ":OGLCompiler",
+    ":OSDependent",
+  ]
+}
+
+static_library("OSDependent") {
+  sources = [
+    "glslang/OSDependent/Unix/ossource.cpp",
+  ]
+}
+
+static_library("OGLCompiler") {
+  sources = [
+    "OGLCompilersDLL/InitializeDll.cpp",
+  ]
+}
+
+static_library("HLSL") {
+  cflags_cc = [
+    "-Wno-reorder",
+    "-Wno-inconsistent-missing-override",
+  ]
+  sources = [
+    "hlsl/hlslAttributes.cpp",
+    "hlsl/hlslGrammar.cpp",
+    "hlsl/hlslOpMap.cpp",
+    "hlsl/hlslParseHelper.cpp",
+    "hlsl/hlslParseables.cpp",
+    "hlsl/hlslScanContext.cpp",
+    "hlsl/hlslTokenStream.cpp",
+  ]
+}
+
+static_library("SPIRV") {
+  cflags_cc = [ "-Wno-reorder" ]
+  sources = [
+    "SPIRV/GlslangToSpv.cpp",
+    "SPIRV/InReadableOrder.cpp",
+    "SPIRV/Logger.cpp",
+    "SPIRV/SpvBuilder.cpp",
+    "SPIRV/disassemble.cpp",
+    "SPIRV/doc.cpp",
+  ]
+}
+
+static_library("SPVRemapper") {
+  sources = [
+    "SPIRV/SPVRemapper.cpp",
+  ]
+}
+
+executable("spirv-remap") {
+  sources = [
+    "StandAlone/spirv-remap.cpp",
+  ]
+  deps = [
+    ":SPVRemapper",
+    ":SPIRV",
+    ":glslang"
+  ]
+}
+
+static_library("glslang-default-resource-limits") {
+  include_dirs = [ "." ]
+  sources = [
+    "StandAlone/ResourceLimits.cpp",
+  ]
+}
+
+executable("glslangValidator") {
+  include_dirs = [ "." ]
+  sources = [
+    "StandAlone/StandAlone.cpp",
+  ]
+  deps = [
+    ":SPIRV",
+    ":SPVRemapper",
+    ":glslang",
+    ":glslang-default-resource-limits",
+  ]
+}
diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp
index 24b77e1..1e690af 100644
--- a/glslang/OSDependent/Unix/ossource.cpp
+++ b/glslang/OSDependent/Unix/ossource.cpp
@@ -67,7 +67,8 @@
 //
 void OS_CleanupThreadData(void)
 {
-#ifdef __ANDROID__
+    // Fuchsia does not have a meaningful pthread_cancel.
+#if defined(__Fuchsia__) || defined(__ANDROID__)
     DetachThreadLinux(NULL);
 #else
     int old_cancel_state, old_cancel_type;