Commit Graph

4096 Commits

Author SHA1 Message Date
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
H. Peter Anvin
d7498067ca BR 3392368: actually fix the documentation; add test case
Add a mimimal test case for this bug; correct the documentation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 21:38:14 -08:00
H. Peter Anvin
8fa279954c Correctly document the BR 3392368 fix, add test case
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 14:59:35 -08:00
H. Peter Anvin
88959910d8 changes.src: document more fixes
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 14:38:32 -08:00
H. Peter Anvin
79a070eea9 BR 3392368: correct handling of exact limb switch
When we have an exact limb switch, we may end up with a case where the
value no longer has any remaining valid bits.  In that case, we end up
relying on the expression *mp |= v << ms shifting the bits on the
subsequent limb all the way to zero, but that is not how real hardware
works when the shift count equals the width of the type. This is
undefined behavior and does, in fact, produce the wrong result.

Instead, change the test for limb shift to (ms < 0), meaning that we
defer the advance to the next limb until we actually need it. At that
point, change the shift into the *old* limb to have a cast to
(fp_2limb) which means the shift right of LIMB_BITS is valid and
produces a zero value as expected.

Reported-by: Brooks Moses <bmoses@google.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 14:17:40 -08:00
H. Peter Anvin
da79432255 BR 3392529: remove excess printf() argument
The input file is provided by nasm_error(), we should not include it
in the printf list (compiler warning + wrong message.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 14:15:46 -08:00
H. Peter Anvin
4885cc2ba8 BR 3392532: outobj: fix forward references to the SEG of external symbols
External symbols are defined via deflabel(), but deflabel() is not
called until pass0 == 1. Until that happens, segbase has no way to
know what the proper segment base of the segment actually is.

Thus, testing for pass0 == 0 will always fail for a forward reference;
correct the test to test for pass0 < 2, i.e. the assert should fail
only for the final code-generation pass.

Reported-by: <stsp@list.ru>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-26 13:41:37 -08:00