diff options
author | Raun Krisch <raun.krisch@gmail.com> | 2022-03-02 20:18:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-02 20:18:40 +0300 |
commit | 0e994ee9c4d4118ae56a7bdb4a7517b6443d2b81 (patch) | |
tree | 721ce1aa6e38fa320a1f19b6a7d6bf714c9c1935 | |
parent | f75fc98badb2bd585390aeae613a2cdbb2ff3310 (diff) | |
parent | bf985e99ecff8f2e25823c245edd2280b83d1901 (diff) |
Merge pull request #261 from ProkopRandacek/master
Include bool type if not already defined
-rw-r--r-- | include/spirv/unified1/spirv.h | 3 | ||||
-rw-r--r-- | include/spirv/unified1/spirv.hpp | 3 | ||||
-rw-r--r-- | include/spirv/unified1/spirv.hpp11 | 3 | ||||
-rw-r--r-- | tools/buildHeaders/header.cpp | 3 |
4 files changed, 12 insertions, 0 deletions
diff --git a/include/spirv/unified1/spirv.h b/include/spirv/unified1/spirv.h index ba1c998..2b6b35f 100644 --- a/include/spirv/unified1/spirv.h +++ b/include/spirv/unified1/spirv.h @@ -1856,6 +1856,9 @@ typedef enum SpvOp_ { } SpvOp; #ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include <stdbool.h> +#endif inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultType) { *hasResult = *hasResultType = false; switch (opcode) { diff --git a/include/spirv/unified1/spirv.hpp b/include/spirv/unified1/spirv.hpp index a016d7d..08eae15 100644 --- a/include/spirv/unified1/spirv.hpp +++ b/include/spirv/unified1/spirv.hpp @@ -1852,6 +1852,9 @@ enum Op { }; #ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include <stdbool.h> +#endif inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { *hasResult = *hasResultType = false; switch (opcode) { diff --git a/include/spirv/unified1/spirv.hpp11 b/include/spirv/unified1/spirv.hpp11 index 89d793c..d203289 100644 --- a/include/spirv/unified1/spirv.hpp11 +++ b/include/spirv/unified1/spirv.hpp11 @@ -1852,6 +1852,9 @@ enum class Op : unsigned { }; #ifdef SPV_ENABLE_UTILITY_CODE +#ifndef __cplusplus +#include <stdbool.h> +#endif inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) { *hasResult = *hasResultType = false; switch (opcode) { diff --git a/tools/buildHeaders/header.cpp b/tools/buildHeaders/header.cpp index febc6f2..f2f16b3 100644 --- a/tools/buildHeaders/header.cpp +++ b/tools/buildHeaders/header.cpp @@ -513,6 +513,9 @@ namespace { } out << "#ifdef SPV_ENABLE_UTILITY_CODE" << std::endl; + out << "#ifndef __cplusplus" << std::endl; + out << "#include <stdbool.h>" << std::endl; + out << "#endif" << std::endl; out << "inline void " << pre() << "HasResultAndType(" << pre() << opName << " opcode, bool *hasResult, bool *hasResultType) {" << std::endl; out << " *hasResult = *hasResultType = false;" << std::endl; out << " switch (opcode) {" << std::endl; |