svn commit: r1521 - in trunk/yasm: libyasm libyasm/tests modules/arch/lc3b modules/arch/x86 modules/dbgfmts/codeview modules/dbgfmts/dwarf2 modules/dbgfmts/null modules/dbgfmts/stabs modules/listfmts/nasm modules/objfmts/bin modules/objfmts/coff modules/objfmts/dbg modules/objfmts/elf modules/objfmts/elf/tests modules/objfmts/xdf modules/optimizers/basic modules/parsers/gas modules/parsers/nasm modules/preprocs/nasm modules/preprocs/raw tools/python-yasm

peter at tortall.net peter at tortall.net
Thu May 4 00:55:46 PDT 2006


Author: peter
Date: Thu May  4 00:55:32 2006
New Revision: 1521

Added:
   trunk/yasm/tools/python-yasm/errwarn.pxi
Modified:
   trunk/yasm/frontends/yasm/yasm.c
   trunk/yasm/libyasm/arch.h
   trunk/yasm/libyasm/bytecode.c
   trunk/yasm/libyasm/bytecode.h
   trunk/yasm/libyasm/coretype.h
   trunk/yasm/libyasm/dbgfmt.h
   trunk/yasm/libyasm/errwarn.c
   trunk/yasm/libyasm/errwarn.h
   trunk/yasm/libyasm/expr.c
   trunk/yasm/libyasm/expr.h
   trunk/yasm/libyasm/floatnum.c
   trunk/yasm/libyasm/floatnum.h
   trunk/yasm/libyasm/intnum.c
   trunk/yasm/libyasm/intnum.h
   trunk/yasm/libyasm/objfmt.h
   trunk/yasm/libyasm/optimizer.h
   trunk/yasm/libyasm/parser.h
   trunk/yasm/libyasm/preproc.h
   trunk/yasm/libyasm/section.c
   trunk/yasm/libyasm/section.h
   trunk/yasm/libyasm/symrec.c
   trunk/yasm/libyasm/symrec.h
   trunk/yasm/libyasm/tests/absloop-err.errwarn
   trunk/yasm/libyasm/tests/floatnum_test.c
   trunk/yasm/libyasm/tests/leb128_test.c
   trunk/yasm/libyasm/tests/value-err.errwarn
   trunk/yasm/libyasm/value.c
   trunk/yasm/modules/arch/lc3b/lc3barch.c
   trunk/yasm/modules/arch/lc3b/lc3barch.h
   trunk/yasm/modules/arch/lc3b/lc3bbc.c
   trunk/yasm/modules/arch/lc3b/lc3bid.re
   trunk/yasm/modules/arch/x86/x86arch.c
   trunk/yasm/modules/arch/x86/x86arch.h
   trunk/yasm/modules/arch/x86/x86bc.c
   trunk/yasm/modules/arch/x86/x86expr.c
   trunk/yasm/modules/arch/x86/x86id.c
   trunk/yasm/modules/dbgfmts/codeview/cv-dbgfmt.c
   trunk/yasm/modules/dbgfmts/codeview/cv-dbgfmt.h
   trunk/yasm/modules/dbgfmts/codeview/cv-symline.c
   trunk/yasm/modules/dbgfmts/codeview/cv-type.c
   trunk/yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c
   trunk/yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
   trunk/yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h
   trunk/yasm/modules/dbgfmts/dwarf2/dwarf2-line.c
   trunk/yasm/modules/dbgfmts/null/null-dbgfmt.c
   trunk/yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c
   trunk/yasm/modules/listfmts/nasm/nasm-listfmt.c
   trunk/yasm/modules/objfmts/bin/bin-objfmt.c
   trunk/yasm/modules/objfmts/coff/coff-objfmt.c
   trunk/yasm/modules/objfmts/dbg/dbg-objfmt.c
   trunk/yasm/modules/objfmts/elf/elf-machine.h
   trunk/yasm/modules/objfmts/elf/elf-objfmt.c
   trunk/yasm/modules/objfmts/elf/elf-x86-amd64.c
   trunk/yasm/modules/objfmts/elf/elf.c
   trunk/yasm/modules/objfmts/elf/elf.h
   trunk/yasm/modules/objfmts/elf/tests/curpos-err.errwarn
   trunk/yasm/modules/objfmts/xdf/xdf-objfmt.c
   trunk/yasm/modules/optimizers/basic/basic-optimizer.c
   trunk/yasm/modules/parsers/gas/gas-bison.y
   trunk/yasm/modules/parsers/gas/gas-parser.c
   trunk/yasm/modules/parsers/gas/gas-parser.h
   trunk/yasm/modules/parsers/gas/gas-token.re
   trunk/yasm/modules/parsers/nasm/nasm-bison.y
   trunk/yasm/modules/parsers/nasm/nasm-parser.c
   trunk/yasm/modules/parsers/nasm/nasm-parser.h
   trunk/yasm/modules/parsers/nasm/nasm-token.re
   trunk/yasm/modules/preprocs/nasm/nasm-preproc.c
   trunk/yasm/modules/preprocs/nasm/nasmlib.c
   trunk/yasm/modules/preprocs/raw/raw-preproc.c
   trunk/yasm/tools/python-yasm/Makefile.inc
   trunk/yasm/tools/python-yasm/bytecode.pxi
   trunk/yasm/tools/python-yasm/coretype.pxi
   trunk/yasm/tools/python-yasm/floatnum.pxi
   trunk/yasm/tools/python-yasm/intnum.pxi
   trunk/yasm/tools/python-yasm/yasm.pyx
Changeset:
   http://www.tortall.net/projects/yasm/changeset/1521

Log:
Revamp error/warning handling, using a model similar to Python's internal
exception handling.  There are now two layers an error or warning goes
through before it hits the user: first an error is logged via
yasm_error_set() (or yasm_warn_set() for a warning).  Only one error may
be set, whereas multiple warnings can be set (yasm_warn_set maintains a
linked list).  Then, calling yasm_errwarn_propagate() propagates any error
and/or warning(s) to an errwarns structure and associates the
errors/warnings with a line number at that time; this call also clears the
pending errors/warnings and allows new ones to be set.  The propagate
function can safely be called when there are no pending error/warnings.

In addition, there are some helper errwarn functions that allow clearing of
an error/warning without propagating, getting it separately, etc.

Still yet to be done: changing most/all uses of yasm_internal_error() into
yasm_error_set(YASM_ERROR_ASSERTION).

The main advantage this change has is making libyasm functions feel much
more library like, and separating the user code line numbers from the inner
function error handling (e.g. intnum create functions only needed the line
number to trigger errors; this is no longer required).

The set/propagate/etc functions use global data structures to avoid passing
around a pointer to every function.  This would need to be made thread-local
data in a threaded app.  Errwarns containers (that keep associated line
numbers) are no longer global, so multiple source streams can be processed
separately with no conflict (at least if there's only a single thread of
execution).



More information about the yasm-cvs mailing list