Warning for #pragma once. GLSL and HLSL. Addresses #824.
authorJohn Kessenich <cepheus@frii.com>
Mon, 12 Feb 2018 05:04:45 +0000 (22:04 -0700)
committerJohn Kessenich <cepheus@frii.com>
Mon, 12 Feb 2018 06:23:22 +0000 (23:23 -0700)
Test/baseResults/preprocessor.pragma.vert.err
Test/baseResults/preprocessor.pragma.vert.out
Test/preprocessor.pragma.vert
glslang/MachineIndependent/ParseHelper.cpp
hlsl/hlslParseHelper.cpp

index 79f5600..0ae7ee2 100644 (file)
@@ -7,5 +7,7 @@
 \r
 #pragma undefined_pragma(x, 4)\r
 \r
+#pragma once\r
+\r
 int main() {\r
 }\r
index e768d46..69f4799 100644 (file)
@@ -266,6 +266,8 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
         if (tokens.size() != 1)
             error(loc, "extra tokens", "#pragma", "");
         intermediate.setUseStorageBuffer();
+    } else if (tokens[0].compare("once") == 0) {
+        warn(loc, "not implemented", "#pragma once", "");
     }
 }
 
index 6602ba2..cba772d 100755 (executable)
@@ -550,6 +550,13 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString
             warn(loc, "unknown pack_matrix pragma value", tokens[2].c_str(), "");
             globalUniformDefaults.layoutMatrix = globalBufferDefaults.layoutMatrix = ElmRowMajor;
         }
+        return;
+    }
+
+    // Handle once
+    if (lowerTokens[0] == "once") {
+        warn(loc, "not implemented", "#pragma once", "");
+        return;
     }
 }