Fix ODR violations

On a shared build, these symbols exist in both libglslang.so and
libSPIRV.so, leading to an ODR violation at runtime.
This commit is contained in:
Pedro Olsen Ferreira 2023-08-21 09:28:46 +01:00 committed by arcady-lunarg
parent f1cb8608b3
commit adfcaba7ae
6 changed files with 15 additions and 21 deletions

View File

@ -118,11 +118,16 @@ private:
unsigned char* mem; // beginning of our allocation (pts to header) unsigned char* mem; // beginning of our allocation (pts to header)
TAllocation* prevAlloc; // prior allocation in the chain TAllocation* prevAlloc; // prior allocation in the chain
const static unsigned char guardBlockBeginVal; static inline constexpr unsigned char guardBlockBeginVal = 0xfb;
const static unsigned char guardBlockEndVal; static inline constexpr unsigned char guardBlockEndVal = 0xfe;
const static unsigned char userDataFill; static inline constexpr unsigned char userDataFill = 0xcd;
# ifdef GUARD_BLOCKS
static inline constexpr size_t guardBlockSize = 16;
# else
static inline constexpr size_t guardBlockSize = 0;
# endif
const static size_t guardBlockSize;
# ifdef GUARD_BLOCKS # ifdef GUARD_BLOCKS
inline static size_t headerSize() { return sizeof(TAllocation); } inline static size_t headerSize() { return sizeof(TAllocation); }
# else # else

View File

@ -61,10 +61,6 @@ const bool ARBCompatibility = true;
const bool ForwardCompatibility = false; const bool ForwardCompatibility = false;
// change this back to false if depending on textual spellings of texturing calls when consuming the AST
// Using PureOperatorBuiltins=false is deprecated.
bool PureOperatorBuiltins = true;
namespace { namespace {
// //

View File

@ -107,6 +107,9 @@ protected:
int dimMap[EsdNumDims]; int dimMap[EsdNumDims];
}; };
// change this back to false if depending on textual spellings of texturing calls when consuming the AST
// Using PureOperatorBuiltins=false is deprecated.
constexpr bool PureOperatorBuiltins = true;
} // end namespace glslang } // end namespace glslang
#endif // _INITIALIZE_INCLUDED_ #endif // _INITIALIZE_INCLUDED_

View File

@ -38,6 +38,7 @@
// //
#include "ParseHelper.h" #include "ParseHelper.h"
#include "Initialize.h"
#include "Scan.h" #include "Scan.h"
#include "../OSDependent/osinclude.h" #include "../OSDependent/osinclude.h"
@ -2685,7 +2686,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
} }
} }
extern bool PureOperatorBuiltins;
// Deprecated! Use PureOperatorBuiltins == true instead, in which case this // Deprecated! Use PureOperatorBuiltins == true instead, in which case this
// functionality is handled in builtInOpCheck() instead of here. // functionality is handled in builtInOpCheck() instead of here.

View File

@ -131,16 +131,6 @@ TPoolAllocator::~TPoolAllocator()
} }
} }
const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
const unsigned char TAllocation::guardBlockEndVal = 0xfe;
const unsigned char TAllocation::userDataFill = 0xcd;
# ifdef GUARD_BLOCKS
const size_t TAllocation::guardBlockSize = 16;
# else
const size_t TAllocation::guardBlockSize = 0;
# endif
// //
// Check a single guard block for damage // Check a single guard block for damage
// //

View File

@ -378,8 +378,6 @@ namespace {
int op_cmpl(int a) { return ~a; } int op_cmpl(int a) { return ~a; }
int op_not(int a) { return !a; } int op_not(int a) { return !a; }
};
struct TBinop { struct TBinop {
int token, precedence, (*op)(int, int); int token, precedence, (*op)(int, int);
} binop[] = { } binop[] = {
@ -412,6 +410,8 @@ struct TUnop {
{ '!', op_not }, { '!', op_not },
}; };
} // anonymous namespace
#define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0])) #define NUM_ELEMENTS(A) (sizeof(A) / sizeof(A[0]))
int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken* ppToken)