#include "SDCCmem.h"
#include "SDCCast.h"
#include "port.h"
+#include "newalloc.h"
+#include "SDCCerr.h"
extern int yyerror (char *);
extern FILE *yyin;
symbol *sym ; /* symbol table pointer */
structdef *sdef; /* structure definition */
char yychar[SDCC_NAME_MAX+1];
- link *lnk ; /* declarator or specifier */
+ sym_link *lnk ; /* declarator or specifier */
int yyint; /* integer value returned */
value *val ; /* for integer constant */
initList *ilist; /* initial list */
- char yyinline[MAX_INLINEASM]; /* inlined assembler code */
+ char *yyinline; /* inlined assembler code */
ast *asts; /* expression tree */
}
symbol *sym , *sym1;
for (sym1 = sym = reverseSyms($2);sym != NULL;sym = sym->next) {
- link *lnk = copyLinkChain($1);
+ sym_link *lnk = copyLinkChain($1);
/* do the pointer stuff */
pointerTypes(sym->type,lnk);
addDecl (sym,0,lnk) ;
/* if the decl $2 is not a specifier */
/* find the spec and replace it */
if ( !IS_SPEC($2)) {
- link *lnk = $2 ;
+ sym_link *lnk = $2 ;
while (lnk && !IS_SPEC(lnk->next))
lnk = lnk->next;
lnk->next = mergeSpec($1,lnk->next);
/* if the decl $2 is not a specifier */
/* find the spec and replace it */
if ( !IS_SPEC($2)) {
- link *lnk = $2 ;
+ sym_link *lnk = $2 ;
while (lnk && !IS_SPEC(lnk->next))
lnk = lnk->next;
lnk->next = mergeSpec($1,lnk->next);
| TYPE_NAME
{
symbol *sym;
- link *p ;
+ sym_link *p ;
sym = findSym(TypedefTab,NULL,$1) ;
$$ = p = copyLinkChain(sym->type);
| '(' declarator ')' { $$ = $2; }
| declarator2 '[' ']'
{
- link *p;
+ sym_link *p;
p = newLink ();
DCL_TYPE(p) = ARRAY ;
}
| declarator2 '[' constant_expr ']'
{
- link *p ;
+ sym_link *p ;
value *tval;
p = (tval = constExprValue($3,TRUE))->etype;
| type_specifier_list abstract_declarator
{
/* go to the end of the list */
- link *p;
+ sym_link *p;
pointerTypes($2,$1);
for ( p = $2 ; p->next ; p=p->next);
p->next = $1 ;
| jump_statement
| INLINEASM ';' {
ast *ex = newNode(INLINEASM,NULL,NULL);
- ALLOC_ATOMIC(ex->values.inlineasm,strlen($1));
+ ex->values.inlineasm = Safe_calloc(1,strlen($1)+1);
strcpy(ex->values.inlineasm,$1);
$$ = ex;
}