Commit Graph

4102 Commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
64471097ca strlist: merge the strtbl and strlist interfaces
The currently-unused strtbl was basically a slightly different version
of strlist, with the find and linearize capabilities. Merge these two
together by augmenting strlist to have the same capabilities.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-11 13:37:32 -08:00
H. Peter Anvin (Intel)
ebb05a0e5f hashtbl: revamp the hash table interface, support binary keys
Add binary key support to the hash table interface. Clean up the
interface to contain less extraneous crud.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-11 13:18:49 -08:00
H. Peter Anvin
ddb290681e error: new flag ERR_HERE
ERR_HERE is used to mark messages of the form "... here" so that we
can emit sane output to the list file with filename and line number,
instead of a nonsensical "here" which could point almost anywhere.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-11 00:06:29 -08:00
H. Peter Anvin
026b62f264 srcfile: simplify and make most functions inline
Simplify the srcfile subsystem by making it official that any pointer
passed to src_get() needs to have been obtained from the srcfile
subsystem itself.

Move a lot of the srcfile operations into inline code; often they
amount to a single machine instruction...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 23:28:01 -08:00
H. Peter Anvin
1aa794527f Move srcfile.c to asm/
srcfile.c is not used by anything outside asm/, so move it there.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 23:03:04 -08:00
H. Peter Anvin
77016c8ff4 errors: unify nasm_verror_{gnu,vc} and remove some ERR_NOFILE
The differences between nasm_verror_{gnu,vc} are a short handful of
strings, so unify them. Remove some additional ERR_NOFILE that are not
necessary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 22:46:30 -08:00
H. Peter Anvin
5bdc235e02 error: remove unused ERR_TOPFILE
The flag ERR_TOPFILE was not used anywhere, remove it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 22:46:28 -08:00
H. Peter Anvin
c55702ecb8 nasm.c: use error helpers, remove ERR_NOFILE
The current error handlers are much smarter about missing filenames,
and thus using ERR_NOFILE just makes it harder for the programmer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 22:46:26 -08:00
H. Peter Anvin
a7bc437eab asm/labels.c: use error helpers
Replace explicit calls to nasm_error() with error helpers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 22:46:24 -08:00
H. Peter Anvin
d351efc97d error: add nasm_note() helper, clean up helper generation
It is fairly easy to more compactly create error helpers since we are
using preprocessor hacks anyway, so do exactly that.

Create nasm_note() helpers for the new NOTE severity class.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 22:46:20 -08:00
H. Peter Anvin
36e3c70790 Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts:
	asm/labels.c
	include/error.h
	version
2018-12-10 21:28:59 -08:00
H. Peter Anvin
54aac9d3c1 errors: add ERR_NOTE and a default clause to error disposition
ERR_NOTE has no action. Have a default clause as well, for good
measure.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 21:14:57 -08:00
H. Peter Anvin
48a810fc19 NASM 2.14.01rc2 2018-12-10 13:38:11 -08:00
H. Peter Anvin
5e1d1a8edd changes.src: update list of changes since 2.14 2018-12-10 13:36:58 -08:00
H. Peter Anvin
b424ae3130 BR 3392534: error out on an inconsistently redefined label
If a label is redefined in the same pass, and the value is
inconsistent, then error out. While we are at it, give the source
location of the previous definition.

This explicitly rejects BR 3392535; there seems to be no reason to
reject duplicate definitions with the same value, as there is no
inconsistency involved.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 13:30:51 -08:00
H. Peter Anvin
d84f9a7153 error: add new severity level "note"
Add a new severity level "note", intended to be used to give
additional information about a previous error.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 13:29:35 -08:00
H. Peter Anvin
070c50fe72 nasm: clean up error messages somewhat
If warnings are errors, print [-w+error=xxxx] and prefix error:.

Use the same spacing for filename and non-filename error messages.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 13:06:48 -08:00
Cyrill Gorcunov
2bc04aff90 output: elf -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-02 11:47:49 +03:00
Cyrill Gorcunov
0623e7dcf5 output: obj -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-02 11:44:38 +03:00
Cyrill Gorcunov
f8d9bf9d83 output: ieee -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-02 11:41:06 +03:00
Cyrill Gorcunov
1c79ece005 output: coff -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-02 11:39:56 +03:00
Cyrill Gorcunov
20029a586c output: bin -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 21:32:15 +03:00
Cyrill Gorcunov
ba499c2ac7 output: as86 -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 21:29:59 +03:00
Cyrill Gorcunov
4dc5360b60 output: aout -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 21:29:14 +03:00
Cyrill Gorcunov
8525757a31 output: codeview -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 21:26:18 +03:00
Cyrill Gorcunov
b449ce49d9 stdscan: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 21:02:51 +03:00
Cyrill Gorcunov
a14e65699b parser: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 20:20:50 +03:00
Cyrill Gorcunov
98bf1ba980 listing: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 20:04:53 +03:00
Cyrill Gorcunov
46c37b3772 labels: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 20:03:55 +03:00
Cyrill Gorcunov
194f93322f float: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 20:01:40 +03:00
Cyrill Gorcunov
636506b78c eval: Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 19:54:15 +03:00
Cyrill Gorcunov
7c5de5b7e1 directiv: Use nasm_ error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 14:17:40 +03:00
Cyrill Gorcunov
f7ce7e85bc test: nasm-t -- Update floatb
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-01 11:38:28 +03:00
Cyrill Gorcunov
fffc005281 test: nasm-t -- Update macro-defaults
We started printing macro name in 1722fcf81c

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-11-29 12:51:40 +03:00
H. Peter Anvin
ba021d044b Run make cleandeps 2018-11-28 15:03:52 -08:00
H. Peter Anvin
53e2e4c099 nctype: add nasm_isquote()
Add nasm_isquote() to test for a NASM quoted string.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 15:01:40 -08:00
H. Peter Anvin
1350620bf1 ctype: create our own ctype table
Create our own ctype table where we can do the tests we want to do
cheaply, instead of calling ctype functions and then adding additional
tests all over the code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 14:55:58 -08:00
H. Peter Anvin
099cc17739 eval: implement the C ? : operator
Add the C ternary conditional ? : operator.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 13:13:16 -08:00
H. Peter Anvin
1722fcf81c preproc.c: tell us which macro definition has too many defaults
We can always be nicer to the user by being more verbose.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 13:05:42 -08:00
H. Peter Anvin
9953992686 nasm.h: fix definition of isidchar()
isidchar() also should accept digits.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 13:02:12 -08:00
H. Peter Anvin
c77f5079e5 Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts:
	asm/nasm.c
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 12:47:25 -08:00
H. Peter Anvin
3475462ee8 nasm: fix the combination -E -MD, handle -MD without a filename
-E -MD should work and output a dependency file.
-MD can be used without a filename; there is a default filename or
-\c{-MF} can be used.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 12:40:58 -08:00
H. Peter Anvin
a074339854 nasm.h: replace is*() macros with inline functions, '?' for TASM mode
Replace all the is*() macros with inline functions. Disallow '?' in
identifiers unless we are in TASM mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
is allowed in
2018-11-28 11:53:05 -08:00
H. Peter Anvin
6fdf710824 eval: 'i' and 'j' are names normally used for iteration variables
Single letter variables in the sequence i, j, k... are normally used
for integer-valued iterators. Rename the token-type variable 'tt', and
use 'tto' (token type, old) when the value is saved across a scan.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 10:33:16 -08:00
H. Peter Anvin
99fcda0e76 expr: wrap the call to the scanner
*Every* call to the scanner is of the form i = scan(scpriv, tokval).
Wrap that in a static function instead of duplicating the code over
and over.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 10:27:30 -08:00
H. Peter Anvin
ef427b3fa1 eval: drop passing (critical) as an argument
There is no point in passing (critical) as an argument when
we alredy rely on a bunch of static variables.  If eval needs to be
reentrant, we should instead have something like "struct eval_state"
and pass a pointer to that as an argument.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 10:19:50 -08:00
H. Peter Anvin
ca605a3c38 expr: allow any expression to contain relational operators
There is absolutely no reason not to allow relational operators in
arbitrary contexts. and doing so can be quite useful.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 10:13:48 -08:00
H. Peter Anvin
a0ed5b3ffa Merge branch 'master' of ssh://repo.or.cz/nasm 2018-11-28 09:56:15 -08:00
H. Peter Anvin
c06c87dbb5 changes.src: fp bug: there are probably other corner cases
There are probably other corner cases where we could at the very
least produce an incorrectly rounded result, so be a bit more cagey
about the description of the bug.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 09:50:14 -08:00
H. Peter Anvin
ee75ec2eed NASM 2.14.01rc1 2018-11-26 21:40:01 -08:00