Tue 13 Sep 2005 12:18:18 PM UTC, comment #1:
Index: tinycc/tcc.c
===================================================================
RCS file: /cvsroot/tinycc/tinycc/tcc.c,v
retrieving revision 1.179
diff -r1.179 tcc.c
126c126
< #define TOK_MAX_SIZE 4 /* token max size in int unit when stored in str
ing */
---
> #define TOK_MAX_SIZE 31 /* token max size in int unit when stored in st
ring */
326a327,328
> static int *user_macro_ptr;
> static int user_saved_buffer[TOK_MAX_SIZE + 1];
4430a4433,4461
> /* varray */
> static inline void put_user_tok_start()
> {
> user_macro_ptr = user_saved_buffer;
> }
>
> static inline void put_user_tok_end()
> {
> const int user_tok_size = (uint32_t)user_macro_ptr - (uint32_t)user_saved_
buffer;
> *user_macro_ptr = 0;
> unget_buffer_enabled = 1;
> if (macro_ptr) {
> memmove((uint8_t*)macro_ptr+user_tok_size, macro_ptr, user_tok_size-1)
;
> memcpy(macro_ptr, user_saved_buffer, user_tok_size-1);
> } else {
> macro_ptr = user_saved_buffer;
> }
> }
>
> static inline void put_user_tok(int last_tok)
> {
> int i, n;
>
> *user_macro_ptr++ = last_tok;
> n = tok_ext_size(tok) - 1;
> for(i=0;i<n;i++)
> *user_macro_ptr++ = tokc.tab[i];
> }
> /* ~varray */
6842a6874,6875
> /* varray */
> static int expr_check_const(void);
6915,6917c6948,6976
< n = expr_const();
< if (n < 0)
< error("invalid array size");
---
> /* varray */
> if (expr_check_const()) {
> n = vtop->c.i;
> vpop();
> if (n < 0)
> error("invalid array size");
> } else {
> put_user_tok_start();
> put_user_tok('=');
> put_user_tok(TOK_alloca);
> put_user_tok('(');
> while(tok != ']') {
> put_user_tok(tok);
> next();
> }
> put_user_tok(')');
> skip(']');
> if (tok != ';')
> error("not support varray type");
> put_user_tok(tok);
> put_user_tok_end();
> next();
>
> s = sym_push(SYM_FIELD, type, 0, -1);
> type->t = (VT_PTR | VT_CONSTANT);
> type->ref = s;
>
> return;
> }
7871a7931,7943
>
> /* varray */
> static int expr_check_const(void)
> {
> int last_tok = tok;
> expr_const1();
> if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST) {
> unget_tok(last_tok);
> return(FALSE);
> }
> return(TRUE);
> }
> /* ~varray */
|