]> granicus.if.org Git - yasm/commit
Revamp error/warning handling, using a model similar to Python's internal
authorPeter Johnson <peter@tortall.net>
Thu, 4 May 2006 07:55:32 +0000 (07:55 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 4 May 2006 07:55:32 +0000 (07:55 -0000)
commit4c33af41ec62c5884c85117f91dce8a6a893b154
tree5954ef1487d86acb65d78cb6af66c3795a57cdce
parente6d2aab9ea0bfb791c9f5930dc2d315581f57e8a
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).

svn path=/trunk/yasm/; revision=1521
76 files changed:
frontends/yasm/yasm.c
libyasm/arch.h
libyasm/bytecode.c
libyasm/bytecode.h
libyasm/coretype.h
libyasm/dbgfmt.h
libyasm/errwarn.c
libyasm/errwarn.h
libyasm/expr.c
libyasm/expr.h
libyasm/floatnum.c
libyasm/floatnum.h
libyasm/intnum.c
libyasm/intnum.h
libyasm/objfmt.h
libyasm/optimizer.h
libyasm/parser.h
libyasm/preproc.h
libyasm/section.c
libyasm/section.h
libyasm/symrec.c
libyasm/symrec.h
libyasm/tests/absloop-err.errwarn
libyasm/tests/floatnum_test.c
libyasm/tests/leb128_test.c
libyasm/tests/value-err.errwarn
libyasm/value.c
modules/arch/lc3b/lc3barch.c
modules/arch/lc3b/lc3barch.h
modules/arch/lc3b/lc3bbc.c
modules/arch/lc3b/lc3bid.re
modules/arch/x86/x86arch.c
modules/arch/x86/x86arch.h
modules/arch/x86/x86bc.c
modules/arch/x86/x86expr.c
modules/arch/x86/x86id.c
modules/dbgfmts/codeview/cv-dbgfmt.c
modules/dbgfmts/codeview/cv-dbgfmt.h
modules/dbgfmts/codeview/cv-symline.c
modules/dbgfmts/codeview/cv-type.c
modules/dbgfmts/dwarf2/dwarf2-aranges.c
modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c
modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h
modules/dbgfmts/dwarf2/dwarf2-line.c
modules/dbgfmts/null/null-dbgfmt.c
modules/dbgfmts/stabs/stabs-dbgfmt.c
modules/listfmts/nasm/nasm-listfmt.c
modules/objfmts/bin/bin-objfmt.c
modules/objfmts/coff/coff-objfmt.c
modules/objfmts/dbg/dbg-objfmt.c
modules/objfmts/elf/elf-machine.h
modules/objfmts/elf/elf-objfmt.c
modules/objfmts/elf/elf-x86-amd64.c
modules/objfmts/elf/elf.c
modules/objfmts/elf/elf.h
modules/objfmts/elf/tests/curpos-err.errwarn
modules/objfmts/xdf/xdf-objfmt.c
modules/optimizers/basic/basic-optimizer.c
modules/parsers/gas/gas-bison.y
modules/parsers/gas/gas-parser.c
modules/parsers/gas/gas-parser.h
modules/parsers/gas/gas-token.re
modules/parsers/nasm/nasm-bison.y
modules/parsers/nasm/nasm-parser.c
modules/parsers/nasm/nasm-parser.h
modules/parsers/nasm/nasm-token.re
modules/preprocs/nasm/nasm-preproc.c
modules/preprocs/nasm/nasmlib.c
modules/preprocs/raw/raw-preproc.c
tools/python-yasm/Makefile.inc
tools/python-yasm/bytecode.pxi
tools/python-yasm/coretype.pxi
tools/python-yasm/errwarn.pxi [new file with mode: 0644]
tools/python-yasm/floatnum.pxi
tools/python-yasm/intnum.pxi
tools/python-yasm/yasm.pyx