aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* warnings: define warning classes at point of usemkwarningsH. Peter Anvin (Intel)2018-12-1318-219/+238
| | | | | | | | | | | | It is extremely desirable to allow the user fine-grained control of warnings, but this has been complicated by the fact that a warning class has had to be defined in no less than three places (error.h, error.c, nasmdoc.src) before it can be used in source code. Instead, use a script to define these via magic comments at the point of use. This hopefully will encourage creating new classes as needed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* errors: change the severity parameter from "int" to "errflags"H. Peter Anvin (Intel)2018-12-1310-32/+38
| | | | | | | Change the severity parameter to the error function from "int" to an unsigned typedef, currently uint32_t. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* Merge remote-tracking branch 'origin/master' into mkwarningsH. Peter Anvin (Intel)2018-12-139-16/+42
|\
| * warnings: change WARN_MNP -> WARN_MACRO_PARAMSH. Peter Anvin (Intel)2018-12-132-3/+3
| | | | | | | | | | | | | | This one got missed during constant name conversion. Make the constants match the options. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * Merge remote-tracking branch 'origin/nasm-2.14.xx'H. Peter Anvin (Intel)2018-12-138-13/+39
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved Conflicts: Makefile.in Mkfiles/msvc.mak Mkfiles/openwcom.mak asm/nasm.c nasmlib/alloc.c Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| | * malloc: handle potential infinite loop in nasm_alloc_failed()H. Peter Anvin (Intel)2018-12-137-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible on memory exhaustion that nasm_fatal() might cause another allocation error, thus calling nasm_alloc_failed() again. If we find us in nasm_alloc_failed() for a second time, try to get a message out and then call abort(). Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | | warnings.pl: script to harvest warnings directly from the sourceH. Peter Anvin (Intel)2018-12-131-0/+184
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it a lot easier to create new warning categories by inserting a block comment directly in the source code near where the warning is used. This block comment should look like: /* *!warning-name {on|off|err} this is a warning *! *! needs a help text. */ nasm_warnf(WARN_WARNING_NAME, ...); Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | warnings: Make WARN_ constants consistent with -w optionsH. Peter Anvin (Intel)2018-12-128-29/+29
| | | | | | | | | | | | Not only does this make it consistent, but allows for automation. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | Merge remote-tracking branch 'origin/nasm-2.14.xx'H. Peter Anvin (Intel)2018-12-126-198/+233
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolved Conflicts: asm/assemble.c asm/directiv.c asm/error.c asm/float.c asm/labels.c asm/listing.c asm/nasm.c asm/parser.c asm/preproc.c asm/stdscan.c include/error.h output/outelf.c version Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * NASM 2.14.01rc3nasm-2.14.01rc3H. Peter Anvin (Intel)2018-12-121-1/+1
| |
| * error: new flag ERR_HEREH. Peter Anvin2018-12-126-71/+87
| | | | | | | | | | | | | | | | | | | | | | 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. This patch contains some changes from the one in the master branch to make the code cleaner. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * errors: unify nasm_verror_{gnu,vc} and remove some ERR_NOFILEH. Peter Anvin2018-12-121-101/+47
| | | | | | | | | | | | | | | | 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>
| * error: remove unused ERR_TOPFILEH. Peter Anvin2018-12-122-3/+4
| | | | | | | | | | | | The flag ERR_TOPFILE was not used anywhere, remove it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * BR 3392535: warning on redefine, promote define-on-pass2 to errorH. Peter Anvin (Intel)2018-12-123-26/+37
| | | | | | | | | | | | | | | | | | | | If we redefine consistently, make it a suppressed-by-default warning. If we end up doing the define on pass 2, promote that to a default-error warning; using a default-error warning allows the user to demote it should they so wish. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Requested-by: C. Masloch <pushbx@38.de>
| * listing.c: handle multiple error messages on a single lineH. Peter Anvin (Intel)2018-12-121-26/+49
| | | | | | | | | | | | | | We may produce an arbitrary number of error messages on a single line; include all of them in the list file. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * warnings: WARN_OTHER is now "above", not "below"H. Peter Anvin (Intel)2018-12-121-1/+1
| | | | | | | | Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * warnings: make it possible for a warning to default to an errorH. Peter Anvin (Intel)2018-12-123-37/+39
| | | | | | | | | | | | | | | | This allows us to do soft-migration of warnings to errors; they will now be nonfatal errors by default, but gives the user the option to demote them. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * warnings; move WARN_OTHER to the end; allow non-warnings to be suppressedH. Peter Anvin (Intel)2018-12-123-92/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Putting WARN_OTHER at the end of the list creates a number of advantages and simplifications: 1. It is more user friendly! It is far more of a logical location for the default case to be at the end of the printed list. 2. The value 0 can be used in a number of places to indicate a non-suppressible event. By having warning_state[0] always contain WARN_ST_ENABLED, we can always do the table lookup, even. 3. It means non-warnings (except fatal/panic) can now be conditioned on warning states. In those cases, WARN_*, including WARN_OTHER, can be added to the mask for any category. This is especially useful for notes. The only downside is that we have to explicitly detect the case where we have ERR_WARNING but no WARN_ flag. This is a trivial test. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * configure: add -Wno-shift-negative-valueH. Peter Anvin (Intel)2018-12-121-0/+5
| | | | | | | | | | | | | | | | | | | | Shifting negative values is undefined in standard C, but we have tons of dependencies that signed arithmetic is 2's-complement in the code anyway, and on gcc-like compilers we pass the -fwrapv option to indicate exactly that. Therefore, this is not a valid warning in our case and should be suppressed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
| * warnings: rename ERR_WARN_* to WARN_*H. Peter Anvin (Intel)2018-12-1213-74/+74
| | | | | | | | | | | | | | | | The prefix ERR_WARN_ is unnecessarily long and may be a disincentive to create new warning categories. Change it to WARN_*, it is still plenty distinctive. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | warnings: rename ERR_WARN_* to WARN_*H. Peter Anvin (Intel)2018-12-1213-73/+73
| | | | | | | | | | | | | | | | | | | | The prefix ERR_WARN_ is unnecessarily long and may be a disincentive to create new warning categories. Change it to WARN_*, it is still plenty distinctive. This is equivalent to nasm-2.14.xx checkin 77f53ba6d4cb90e5a7e09b33357ed7c1fe9f6b9d. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | nasmlib: Add nasm_(v)asprintf()H. Peter Anvin (Intel)2018-12-128-24/+92
| | | | | | | | | | | | | | | | | | Add a version of (v)asprintf(), which allocates a string on the heap. Unlike the standard version of (v)asprintf(), we return the pointer; if one wants the length of the string then one can simply use the %n pattern. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* | strlist: merge the strtbl and strlist interfacesH. Peter Anvin (Intel)2018-12-1110-196/+72
| | | | | | | | | | | | | | | | 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>
* | hashtbl: revamp the hash table interface, support binary keysH. Peter Anvin (Intel)2018-12-1111-152/+215
| | | | | | | | | | | | | | 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>
* | error: new flag ERR_HEREH. Peter Anvin2018-12-116-25/+52
| | | | | | | | | | | | | | | | 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>
* | srcfile: simplify and make most functions inlineH. Peter Anvin2018-12-102-35/+56
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Move srcfile.c to asm/H. Peter Anvin2018-12-105-20/+64
| | | | | | | | | | | | srcfile.c is not used by anything outside asm/, so move it there. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | errors: unify nasm_verror_{gnu,vc} and remove some ERR_NOFILEH. Peter Anvin2018-12-101-106/+51
| | | | | | | | | | | | | | | | 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>
* | error: remove unused ERR_TOPFILEH. Peter Anvin2018-12-102-2/+1
| | | | | | | | | | | | The flag ERR_TOPFILE was not used anywhere, remove it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | nasm.c: use error helpers, remove ERR_NOFILEH. Peter Anvin2018-12-101-46/+24
| | | | | | | | | | | | | | 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>
* | asm/labels.c: use error helpersH. Peter Anvin2018-12-101-5/+4
| | | | | | | | | | | | Replace explicit calls to nasm_error() with error helpers. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* | error: add nasm_note() helper, clean up helper generationH. Peter Anvin2018-12-102-66/+27
| | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/nasm-2.14.xx'H. Peter Anvin2018-12-104-26/+88
|\| | | | | | | | | | | | | Resolved Conflicts: asm/labels.c include/error.h version
| * errors: add ERR_NOTE and a default clause to error dispositionnasm-2.14.01rc2H. Peter Anvin2018-12-101-0/+3
| | | | | | | | | | | | | | ERR_NOTE has no action. Have a default clause as well, for good measure. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * NASM 2.14.01rc2H. Peter Anvin2018-12-101-1/+1
| |
| * changes.src: update list of changes since 2.14H. Peter Anvin2018-12-101-0/+6
| |
| * BR 3392534: error out on an inconsistently redefined labelH. Peter Anvin2018-12-101-18/+59
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * error: add new severity level "note"H. Peter Anvin2018-12-102-4/+8
| | | | | | | | | | | | | | 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>
| * nasm: clean up error messages somewhatH. Peter Anvin2018-12-101-7/+14
| | | | | | | | | | | | | | | | 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>
* | output: elf -- Use nasm_error helpersCyrill Gorcunov2018-12-021-117/+107
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: obj -- Use nasm_error helpersCyrill Gorcunov2018-12-021-77/+63
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: ieee -- Use nasm_error helpersCyrill Gorcunov2018-12-021-18/+14
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: coff -- Use nasm_error helpersCyrill Gorcunov2018-12-021-42/+37
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: bin -- Use nasm_error helpersCyrill Gorcunov2018-12-011-81/+64
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: as86 -- Use nasm_error helpersCyrill Gorcunov2018-12-011-17/+17
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: aout -- Use nasm_error helpersCyrill Gorcunov2018-12-011-50/+47
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | output: codeview -- Use nasm_error helpersCyrill Gorcunov2018-12-011-3/+3
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | stdscan: Use nasm_error helpersCyrill Gorcunov2018-12-011-8/+6
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | parser: Use nasm_error helpersCyrill Gorcunov2018-12-011-84/+58
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* | listing: Use nasm_error helpersCyrill Gorcunov2018-12-011-2/+1
| | | | | | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>