No more flexible array members (not standard C++) (#1307)

* Replace FAMs with `std::vector`s (or one `std::string`) in four `struct`s

* Anonymous types declared in an anonymous union are also non-standard
  Only Clang complains about this (-Wnested-anon-types)
This commit is contained in:
Sylvie
2024-02-22 16:22:37 -05:00
committed by GitHub
parent 6d29d2a67e
commit c0d534f5ad
12 changed files with 170 additions and 203 deletions

View File

@@ -9,6 +9,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string>
#include <vector>
#include "asm/lexer.hpp"
@@ -28,14 +29,12 @@ struct FileStackNode {
struct FileStackReptNode { // NODE_REPT
struct FileStackNode node;
uint32_t reptDepth;
// WARNING: if changing this type, change overflow check in `fstk_Init`
uint32_t iters[]; // REPT iteration counts since last named node, in reverse depth order
std::vector<uint32_t> *iters; // REPT iteration counts since last named node, in reverse depth order
};
struct FileStackNamedNode { // NODE_FILE, NODE_MACRO
struct FileStackNode node;
char name[]; // File name for files, file::macro name for macros
std::string *name; // File name for files, file::macro name for macros
};
#define DEFAULT_MAX_DEPTH 64