ir_block **breakblocks;
ir_block **continueblocks;
-#if 0
- /* In order for early-out logic not to go over
- * excessive jumps, we remember their target
- * blocks...
- */
- ir_block *iftrue;
- ir_block *iffalse;
-#endif
-
size_t labelcount;
/* in order for thread safety - for the optional
* channel abesed multithreading... keeping a buffer
con_out("\n");
}
-/*
- * Same principle except this one allocates memory and writes the lno(optional) and the dat file
- * directly out to allocated memory. Which is actually very useful for the future library support
- * we're going to add.
- */
-#if 0
-static bool code_write_memory(code_t *code, uint8_t **datmem, size_t *sizedat, uint8_t **lnomem, size_t *sizelno) GMQCC_UNUSED {
- prog_header_t code_header;
- uint32_t offset = 0;
-
- if (!datmem)
- return false;
-
- code_create_header(code, &code_header, "<<memory>>", "<<memory>>");
-
- #define WRITE_CHUNK(C,X,S) \
- do { \
- memcpy((void*)(&(*C)[offset]), (const void*)(X), (S)); \
- offset += (S); \
- } while (0)
-
- /* Calculate size required to store entire file out to memory */
- if (lnomem) {
- uint32_t version = 1;
-
- *sizelno = code_size_debug(code, &code_header);
- *lnomem = (uint8_t*)mem_a(*sizelno);
-
- WRITE_CHUNK(lnomem, "LNOF", 4);
- WRITE_CHUNK(lnomem, &version, sizeof(version));
- WRITE_CHUNK(lnomem, &code_header.defs.length, sizeof(code_header.defs.length));
- WRITE_CHUNK(lnomem, &code_header.globals.length, sizeof(code_header.globals.length));
- WRITE_CHUNK(lnomem, &code_header.fields.length, sizeof(code_header.fields.length));
- WRITE_CHUNK(lnomem, &code_header.statements.length, sizeof(code_header.statements.length));
-
- /* something went terribly wrong */
- if (offset != *sizelno) {
- mem_d(*lnomem);
- *sizelno = 0;
- return false;
- }
- offset = 0;
- }
-
- /* Write out the dat */
- *sizedat = code_size_binary(code, &code_header);
- *datmem = (uint8_t*)mem_a(*sizedat);
-
- WRITE_CHUNK(datmem, &code_header, sizeof(prog_header_t));
- WRITE_CHUNK(datmem, code->statements, sizeof(prog_section_statement_t) * vec_size(code->statements));
- WRITE_CHUNK(datmem, code->defs, sizeof(prog_section_def_t) * vec_size(code->defs));
- WRITE_CHUNK(datmem, code->fields, sizeof(prog_section_field_t) * vec_size(code->fields));
- WRITE_CHUNK(datmem, code->functions, sizeof(prog_section_function_t) * vec_size(code->functions));
- WRITE_CHUNK(datmem, code->globals, sizeof(int32_t) * vec_size(code->globals));
- WRITE_CHUNK(datmem, code->chars, 1 * vec_size(code->chars));
-
- vec_free(code->statements);
- vec_free(code->linenums);
- vec_free(code->columnnums);
- vec_free(code->defs);
- vec_free(code->fields);
- vec_free(code->functions);
- vec_free(code->globals);
- vec_free(code->chars);
-
- util_htdel(code->string_cache);
- mem_d(code);
- code_stats("<<memory>>", (lnomem) ? "<<memory>>" : NULL, code, &code_header);
- return true;
-}
-#endif /*!#if 0 reenable when ready to be used */
-#undef WRITE_CHUNK
-
bool code_write(code_t *code, const char *filename, const char *lnofile) {
prog_header_t code_header;
FILE *fp = NULL;
{
pptoken *token = (pptoken*)mem_a(sizeof(pptoken));
token->token = ftepp->token;
-#if 0
- if (token->token == TOKEN_WHITE)
- token->value = util_strdup(" ");
- else
-#else
- token->value = util_strdup(ftepp_tokval(ftepp));
-#endif
+ token->value = util_strdup(ftepp_tokval(ftepp));
memcpy(&token->constval, &ftepp->lex->tok.constval, sizeof(token->constval));
return token;
}
{
if (ftepp->token >= TOKEN_EOF)
break;
-#if 0
- newline = true;
-#endif
-
switch (ftepp->token) {
case TOKEN_KEYWORD:
case TOKEN_IDENT:
/* hidden interface */
void _util_vec_grow(void **a, size_t i, size_t s);
-void _util_vec_delete(void *vec, size_t line, const char *file);
+void _util_vec_delete(void *vec);
#define GMQCC_VEC_WILLGROW(X, Y) ( \
((!(X) || vec_meta(X)->used + Y >= vec_meta(X)->allocated)) ? \
/* exposed interface */
#define vec_meta(A) ((vector_t*)(((char *)(A)) - sizeof(vector_t)))
-#define vec_free(A) ((void)((A) ? (_util_vec_delete((void *)(A), __LINE__, __FILE__), (A) = NULL) : 0))
+#define vec_free(A) ((void)((A) ? (_util_vec_delete((void *)(A)), (A) = NULL) : 0))
#define vec_push(A,V) (GMQCC_VEC_WILLGROW((A),1), (A)[vec_meta(A)->used++] = (V))
#define vec_size(A) ((A) ? vec_meta(A)->used : 0)
#define vec_add(A,N) (GMQCC_VEC_WILLGROW((A),(N)), vec_meta(A)->used += (N), &(A)[vec_meta(A)->used-(N)])
int t; /* type */
} constval;
-#if 0
- struct token_s *next;
- struct token_s *prev;
-#endif
-
lex_ctx_t ctx;
};
-#if 0
-token* token_new();
-void token_delete(token*);
-token* token_copy(const token *cp);
-void token_delete_all(token *t);
-token* token_copy_all(const token *cp);
-#endif
-
/* Lexer
*
*/
bool argend = false;
size_t itr;
char buffer[1024];
- char *redirout = NULL;
- char *redirerr = NULL;
char *config = NULL;
char *memdumpcols = NULL;
return false;
}
out = (ast_expression*)ast_array_index_new(ctx, exprs[0], exprs[1]);
- if (rotate_entfield_array_index_nodes(&out))
- {
-#if 0
- /* This is not broken in fteqcc anymore */
- if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
- /* this error doesn't need to make us bail out */
- (void)!parsewarning(parser, WARN_EXTENSIONS,
- "accessing array-field members of an entity without parenthesis\n"
- " -> this is an extension from -std=gmqcc");
- }
-#endif
- }
+ rotate_entfield_array_index_nodes(&out);
break;
case opid1(','):
else if (!wantop) {
if (!parse_sya_operand(parser, &sy, with_labels))
goto onerr;
-#if 0
- if (vec_size(sy.paren) && vec_last(sy.ops).isparen && vec_last(sy.paren) == PAREN_FUNC)
- vec_last(sy.argc)++;
-#endif
wantop = true;
}
else {
typevar = parser_find_typedef(parser, parser_tokval(parser), 0);
if (typevar || parser->tok == TOKEN_TYPENAME) {
-#if 0
- if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
- if (parsewarning(parser, WARN_EXTENSIONS,
- "current standard does not allow variable declarations in for-loop initializers"))
- goto onerr;
- }
-#endif
if (!parse_variable(parser, block, true, CV_VAR, typevar, false, false, 0, NULL))
goto onerr;
}
*a = d + 1;
}
-void _util_vec_delete(void *data, size_t line, const char *file) {
+void _util_vec_delete(void *data) {
mem_d(vec_meta(data));
}