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>
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>
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>
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>
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>
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>
-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>
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
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>
*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>
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>
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>
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>
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>
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>
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>