Added error for duplicate definitions of labels.

Changed strdup to y_strdup (ANSI compatibility).

svn path=/trunk/yasm/; revision=53
0.3
Michael Urman 24 years ago
parent 26e001cc18
commit 18e368c82e
  1. 5
      include/errwarn.h
  2. 7
      libyasm/errwarn.c
  3. 5
      libyasm/errwarn.h
  4. 4
      libyasm/symrec.c
  5. 7
      src/errwarn.c
  6. 5
      src/errwarn.h
  7. 4
      src/symrec.c

@ -1,4 +1,4 @@
/* $Id: errwarn.h,v 1.5 2001/06/13 05:43:59 mu Exp $
/* $Id: errwarn.h,v 1.6 2001/06/13 05:56:06 mu Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
@ -39,7 +39,8 @@ typedef enum {
ERR_INVALID_ARG,
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX
ERR_EXP_SYNTAX,
ERR_DUPLICATE_DEF
} err_num;
void Error(err_num, char *, ...);

@ -1,4 +1,4 @@
/* $Id: errwarn.c,v 1.7 2001/06/13 05:53:25 peter Exp $
/* $Id: errwarn.c,v 1.8 2001/06/13 05:56:06 mu Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
@ -43,7 +43,8 @@ static char *err_msgs[] = {
"invalid argument to %s",
"invalid effective address",
"label or instruction expected at start of line",
"expression syntax error"
"expression syntax error",
"duplicate definition of `%s'; previously defined line %d"
};
static char *warn_msgs[] = {
@ -130,7 +131,7 @@ static char *process_argtypes(char *src, char *argtypes)
}
}
} else {
dest = strdup(src);
dest = y_strdup(src);
if(!dest)
Fatal(FATAL_NOMEM);
}

@ -1,4 +1,4 @@
/* $Id: errwarn.h,v 1.5 2001/06/13 05:43:59 mu Exp $
/* $Id: errwarn.h,v 1.6 2001/06/13 05:56:06 mu Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
@ -39,7 +39,8 @@ typedef enum {
ERR_INVALID_ARG,
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX
ERR_EXP_SYNTAX,
ERR_DUPLICATE_DEF
} err_num;
void Error(err_num, char *, ...);

@ -1,4 +1,4 @@
/* $Id: symrec.c,v 1.2 2001/06/13 05:43:59 mu Exp $
/* $Id: symrec.c,v 1.3 2001/06/13 05:56:06 mu Exp $
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman
@ -116,6 +116,8 @@ symrec *sym_def_get (char *name, SymType type)
{
symtab *tab;
tab = symtab_get_or_new (name, type);
if (tab->rec.status & SYM_DECLARED)
Error (ERR_DUPLICATE_DEF, (char *)NULL, tab->rec.name, tab->rec.line);
tab->rec.status |= SYM_DECLARED;
return &(tab->rec);
}

@ -1,4 +1,4 @@
/* $Id: errwarn.c,v 1.7 2001/06/13 05:53:25 peter Exp $
/* $Id: errwarn.c,v 1.8 2001/06/13 05:56:06 mu Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
@ -43,7 +43,8 @@ static char *err_msgs[] = {
"invalid argument to %s",
"invalid effective address",
"label or instruction expected at start of line",
"expression syntax error"
"expression syntax error",
"duplicate definition of `%s'; previously defined line %d"
};
static char *warn_msgs[] = {
@ -130,7 +131,7 @@ static char *process_argtypes(char *src, char *argtypes)
}
}
} else {
dest = strdup(src);
dest = y_strdup(src);
if(!dest)
Fatal(FATAL_NOMEM);
}

@ -1,4 +1,4 @@
/* $Id: errwarn.h,v 1.5 2001/06/13 05:43:59 mu Exp $
/* $Id: errwarn.h,v 1.6 2001/06/13 05:56:06 mu Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
@ -39,7 +39,8 @@ typedef enum {
ERR_INVALID_ARG,
ERR_INVALID_EA,
ERR_INVALID_LINE,
ERR_EXP_SYNTAX
ERR_EXP_SYNTAX,
ERR_DUPLICATE_DEF
} err_num;
void Error(err_num, char *, ...);

@ -1,4 +1,4 @@
/* $Id: symrec.c,v 1.2 2001/06/13 05:43:59 mu Exp $
/* $Id: symrec.c,v 1.3 2001/06/13 05:56:06 mu Exp $
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman
@ -116,6 +116,8 @@ symrec *sym_def_get (char *name, SymType type)
{
symtab *tab;
tab = symtab_get_or_new (name, type);
if (tab->rec.status & SYM_DECLARED)
Error (ERR_DUPLICATE_DEF, (char *)NULL, tab->rec.name, tab->rec.line);
tab->rec.status |= SYM_DECLARED;
return &(tab->rec);
}

Loading…
Cancel
Save