Skip to content

Commit

Permalink
Fixes weird alignment nonsense in ConstExpression
Browse files Browse the repository at this point in the history
Just having a bloat array in there is like... fine enough. We don't need to get fancy with this.
  • Loading branch information
Altoids1 committed Jan 2, 2023
1 parent 1d4bc2a commit a22fce8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,11 @@ class BaseTableConstruction : public ASTNode
/// <summary>
/// Holds "const {}" blocks which are evaluated as a returned Value before any other code is run.
/// </summary>
class
alignas(Literal) alignas(64) // The point of this is to make absolutely sure that ConstExpression is able to store a Literal;
// on 32-bit platforms and a few compilers, this is a necessary addition to uphold the static_assert in transmute().
ConstExpression : public Block {
class ConstExpression : public Block {
static std::vector<ConstExpression*> _registry;
#ifdef ENVIRONMENT32
char bloat[16];
#endif
public:
ConstExpression(const std::vector<Expression*>& s)
:Block(s)
Expand Down
18 changes: 18 additions & 0 deletions Forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,24 @@
#define UNLIKELY
#endif

// Check windows
#if _WIN32 || _WIN64
#if _WIN64
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif

// Check GCC/Clang/whatever
#if __GNUC__
#if __x86_64__ || __ppc64__
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif

#include "config.h"

#ifdef DEBUG
Expand Down

0 comments on commit a22fce8

Please sign in to comment.