Skip to content

Commit 0e994ee

Browse files
authored
Merge pull request KhronosGroup#261 from ProkopRandacek/master
Include bool type if not already defined
2 parents f75fc98 + bf985e9 commit 0e994ee

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

include/spirv/unified1/spirv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,9 @@ typedef enum SpvOp_ {
18561856
} SpvOp;
18571857

18581858
#ifdef SPV_ENABLE_UTILITY_CODE
1859+
#ifndef __cplusplus
1860+
#include <stdbool.h>
1861+
#endif
18591862
inline void SpvHasResultAndType(SpvOp opcode, bool *hasResult, bool *hasResultType) {
18601863
*hasResult = *hasResultType = false;
18611864
switch (opcode) {

include/spirv/unified1/spirv.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,9 @@ enum Op {
18521852
};
18531853

18541854
#ifdef SPV_ENABLE_UTILITY_CODE
1855+
#ifndef __cplusplus
1856+
#include <stdbool.h>
1857+
#endif
18551858
inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
18561859
*hasResult = *hasResultType = false;
18571860
switch (opcode) {

include/spirv/unified1/spirv.hpp11

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,9 @@ enum class Op : unsigned {
18521852
};
18531853

18541854
#ifdef SPV_ENABLE_UTILITY_CODE
1855+
#ifndef __cplusplus
1856+
#include <stdbool.h>
1857+
#endif
18551858
inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
18561859
*hasResult = *hasResultType = false;
18571860
switch (opcode) {

tools/buildHeaders/header.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,9 @@ namespace {
513513
}
514514

515515
out << "#ifdef SPV_ENABLE_UTILITY_CODE" << std::endl;
516+
out << "#ifndef __cplusplus" << std::endl;
517+
out << "#include <stdbool.h>" << std::endl;
518+
out << "#endif" << std::endl;
516519
out << "inline void " << pre() << "HasResultAndType(" << pre() << opName << " opcode, bool *hasResult, bool *hasResultType) {" << std::endl;
517520
out << " *hasResult = *hasResultType = false;" << std::endl;
518521
out << " switch (opcode) {" << std::endl;

0 commit comments

Comments
 (0)