0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00
Files
nasm/asm/warnings.dat
H. Peter Anvin a8bcdb641b Warnings: disaggregate from source and tidy up documentation
The idea of putting the warnings in the source code was a nice one,
really, but it ended up being a nightmare from the perspective of
build dependencies. Disaggregate them, and tweak the documentation for
easier reading.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-04 13:46:39 -07:00

426 lines
17 KiB
Plaintext

all [group] all possible warnings
\c{all} is an group alias for \e{all} warning classes. Thus, \c{-w+all}
enables all available warnings, and \c{-w-all} disables warnings
entirely (since NASM 2.13).
db-empty [on] no operand for data declaration
Warns about a \c{D}\e{x} declaration
with no operands, producing no output.
This is permitted, but often indicative of an error.
See \k{db}.
ea-absolute [on] absolute address cannot be RIP-relative
Warns that an address that is inherently absolute cannot
be generated with RIP-relative encoding using \c{REL},
see \k{default-rel}.
ea-dispsize [on] displacement size ignored on absolute address
Warns that NASM does not support generating displacements for
inherently absolute addresses that do not match the address size
of the instruction.
float-denorm [off] floating point denormal
Warns about denormal floating point constants.
float-overflow [on] floating point overflow
Warns about floating point underflow.
float-toolong [on] too many digits in floating-point number
Warns about too many digits in floating-point numbers.
float-underflow [off] floating point underflow
Warns about floating point underflow (a nonzero
constant rounded to zero.)
forward [on] forward reference may have unpredictable results
Warns that a forward reference is used which may have
unpredictable results, notably in a \c{RESB}-type
pseudo-instruction. These would be \i\e{critical
expressions} (see \k{crit}) but are permitted in a
handful of cases for compatibility with older
versions of NASM. This warning should be treated as a
severe programming error as the code could break at
any time for any number of reasons.
implicit-abs-deprecated [on] implicit DEFAULT ABS is deprecated
Warns that in a future version of NASM, the 64-bit default
addressing form is likely to change from \c{DEFAULT ABS} to
\c{DEFAULT REL}. If absolute addressing is indeed intended, it is
strongly recommended to specify \c{DEFAULT ABS} explicitly.
label-orphan [on] labels alone on lines without trailing \c{:}
=orphan-labels
Warns about source lines which contain no instruction but define
a label without a trailing colon. This is most likely indicative
of a typo, but is technically correct NASM syntax (see \k{syntax}.)
label-redef [off] label redefined to an identical value
Warns if a label is defined more than once, but the
value is identical. It is an unconditional error to
define the same label more than once to \e{different} values.
#
# label-redef-late defaults to an error, as this should never
# actually happen. Just in case this is a backwards
# compatibility problem, still make it a warning so that the
# user can suppress or demote it.
#
label-redef-late [err] label (re)defined during code generation
The value of a label changed during the final, code-generation
pass. This may be the result of strange use of the
preprocessor. This is very likely to produce incorrect code and
may end up being an unconditional error in a future
version of NASM.
number-deprecated-hex [on] $ prefix for hexadecimal is deprecated
Warns that the \c{$} prefix for hexadecimal numbers is
deprecated, due to the syntactic conflict with \c{$} used
as a symbol escape prefix. This syntax may be disabled by
default in a future version of NASM. Replace \c{$} with \c{0x}
to ensure compatibility with future versions.
number-overflow [on] numeric constant does not fit
Covers warnings about numeric constants which
don't fit in 64 bits.
obsolete-nop [on] instruction obsolete and is a noop on the target CPU
Warns for an instruction which has been removed
from the architecture, but has been architecturally
defined to be a noop for future CPUs.
obsolete-removed [on] instruction obsolete and removed on the target CPU
Warns for an instruction which has been removed
from the architecture, and is no longer included
in the CPU definition given in the \c{[CPU]}
directive, for example \c{POP CS}, the opcode for
which, \c{0Fh}, instead is an opcode prefix on
CPUs newer than the first generation 8086.
obsolete-valid [on] instruction obsolete but valid on the target CPU
Warns for an instruction which has been removed
from the architecture, but is still valid on the
specific CPU given in the \c{CPU} directive. Code
using these instructions is most likely not
forward compatible.
other [on] any warning not assigned to a specific warning class
Specifies any warning not included in any specific warning class.
phase [off] phase error during stabilization
Warns about symbols having changed values during
the second-to-last assembly pass. This is not
inherently fatal, but may be a source of bugs.
pp-else-elif [on] \c{%elif} after \c{%else}
Warns that an \c{%elif}-type directive was encountered
after \c{%else} has already been encounted. As a result, the
content of the \c{%elif} will never be expanded.
pp-else-else [on] \c{%else} after \c{%else}
Warns that a second \c{%else} clause was found for
the same \c{%if} statement. The content of this \c{%else}
clause will never be expanded.
pp-empty-braces [on] empty \c{%\{\}} construct
Warns that an empty \c{%\{\}} was encountered.
This expands to a single \c{%} character, which
is normally the \c{%} arithmetic operator.
pp-environment [on] nonexistent environment variable
=environment
Warns if a nonexistent environment variable
is accessed using the \c{%!} preprocessor
construct (see \k{getenv}.) Such environment
variables are treated as empty (with this
warning issued) starting in NASM 2.15;
earlier versions of NASM would treat this as
an error.
pp-macro-def-case-single [on] single-line macro defined both case sensitive and insensitive
=macro-def-case-single
Warns when a single-line macro is defined both case
sensitive and case insensitive.
The new macro
definition will override (shadow) the original one,
although the original macro is not deleted, and will
be re-exposed if the new macro is deleted with
\c{%undef}, or, if the original macro is the case
insensitive one, the macro call is done with a
different case.
pp-macro-def-greedy-single [on] single-line macro
=macro-def-greedy-single
Warns that a single-line macro is defined which would match a
previously existing greedy definition. The new macro definition
will override (shadow) the original one, although the original
macro is not deleted, and will be re-exposed if the new macro is
deleted with \c{%undef}, and will be invoked if called with a
parameter count that does not match the new definition.
# The immediately previous versions of NASM considered
# this an error, so promote this warning is promoted to
# to error by default.
pp-macro-def-param-single [err] single-line macro defined with and without parameters
=macro-def-param-single
Warns if the same single-line macro is defined with and without
parameters. The new macro definition will override (shadow) the
original one, although the original macro is not deleted, and will
be re-exposed if the new macro is deleted with \c{%undef}.
pp-macro-defaults [on] macros with more default than optional parameters
=macro-defaults
Warns when a macro has more default parameters than optional parameters.
See \k{mlmacdef} for why one might want to disable this warning.
pp-macro-params-legacy [on] improperly calling multi-line macro for legacy support
=macro-params-legacy
Warns about \i{multi-line macros} being invoked
with the wrong number of parameters, but for bug-compatibility
with NASM versions older than 2.15, NASM tried to fix up the
parameters to match the legacy behavior and call the macro anyway.
This can happen in certain cases where there are empty arguments
without braces, sometimes as a result of macro expansion.
The legacy behavior is quite strange and highly context-dependent,
and can be disabled with:
\c %pragma preproc sane_empty_expansion true
It is highly recommended to use this option in new code.
pp-macro-params-multi [on] multi-line macro calls with wrong parameter count
=macro-params-multi
Warns about \i{multi-line macros} being invoked
with the wrong number of parameters. See \k{mlmacover} for an
example of why you might want to disable this warning.
pp-macro-params-single [on] single-line macro calls with wrong parameter count
=macro-params-single
Warns about \i{single-line macros} being invoked
with the wrong number of parameters.
pp-macro-redef-multi [on] redefining multi-line macro
Warns that a multi-line macro is being redefined,
without first removing the old definition with
\c{%unmacro}.
pp-open-braces [on] unterminated \c{%\{...\}}
Warns that a preprocessor parameter
enclosed in braces \c{%\{...\}} lacks the
terminating \c{\}} character.
pp-open-brackets [on] unterminated \c{%[...]}
Warns that a preprocessor \c{%[...]} construct
lacks the terminating \c{]} character.
pp-open-string [on] unterminated string
Warns that a quoted string without a closing quotation
mark was encountered during preprocessing.
pp-rep-negative [on] regative \c{%rep} count
=negative-rep
Warns about a negative count given to the \c{%rep}
preprocessor directive.
pp-sel-range [on] \c{%sel()} argument out of range
Warns that the \c{%sel()} preprocessor function was passed
a value less than 1 or larger than the number of available
arguments.
pp-trailing [on] trailing garbage ignored
Warns that the preprocessor encountered additional text
where no such text was expected. This can
sometimes be the result of an incorrectly written expression,
or arguments that are inadvertently separated.
pragma-bad [off] malformed \c{%pragma}
=bad-pragma
Warns about a malformed or otherwise unparsable
\c{%pragma} directive.
pragma-empty [off] empty \c{%pragma} directive
Warns about a \c{%pragma} directive containing nothing.
This is treated identically to \c{%pragma ignore} except
for this optional warning.
# Not implemented yet
pragma-na [off] \c{%pragma} not applicable to this compilation
=not-my-pragma
Warns about a \c{%pragma} directive which is not applicable to
this particular assembly session. This is not yet implemented.
pragma-unknown [off] unknown \c{%pragma} facility or directive
=unknown-pragma
Warns about an unknown \c{%pragma} directive.
This is not yet implemented for most cases.
prefix-bnd [on] invalid \c{BND} prefix
=bnd
Warns about ineffective use of the \c{BND} prefix when the
\c{JMP} instruction is converted to the \c{SHORT} form.
This should be extremely rare since the short \c{JMP} only
is applicable to jumps inside the same module, but if
it is legitimate, it may be necessary to use
\c{bnd jmp dword}.
prefix-hint-dropped [on] invalid branch hint prefix dropped
Warns that the \c{{PT}} (predict taken) or \c{{PN}}
(predict not taken) branch prediction hint prefixes
are specified on an instruction that does not take
these prefixes. As these prefixes alias the segment
override prefixes, this may be a very serious error,
and therefore NASM will not generate these prefixes.
To force these prefixes to be emitted, use \c{DS} or
\c{CS}, instead, respectively.
prefix-hle [on] invalid HLE prefix
=hle
Warns about invalid use of the HLE \c{XACQUIRE} or \c{XRELEASE}
prefixes.
prefix-invalid [on] invalid prefix for instruction
Warns about an instruction which is only valid with certain
combinations of prefixes. The prefix will still be generated as
requested, but the result may be a completely different
instruction or result in a \c{#UD} trap.
prefix-lock-error [on] \c{LOCK} prefix on unlockable instruction
=lock
Warns about \c{LOCK} prefixes specified on unlockable instructions.
prefix-lock-xchg [on] superfluous \c{LOCK} prefix on \c{XCHG} instruction
Warns about a \c{LOCK} prefix added to an \c{XCHG} instruction.
The \c{XCHG} instruction is \e{always} locking, and so this
prefix is not necessary; however, NASM will generate it if
explicitly provided by the user, so this warning indicates that
suboptimal code is being generated.
prefix-opsize [on] invalid operand size prefix
Warns that an operand prefix (\c{o16}, \c{o32}, \c{o64},
\c{osp}) invalid for the specified instruction has been specified.
The operand prefix will be ignored by the assembler.
prefix-seg [on] segment prefix ignored in 64-bit mode
Warns that an \c{es}, \c{cs}, \c{ss} or \c{ds} segment override
prefix has no effect in 64-bit mode. The prefix will still be
generated as requested.
ptr [on] non-NASM keyword used in other assemblers
Warns about keywords used in other assemblers that
might indicate a mistake in the source code.
Currently only the MASM \c{PTR} keyword is
recognized. If (limited) MASM compatibility is
desired, the \c{%use masm} macro package is
available, see \k{pkg_masm}; however, carefully note
the caveats listed.
regsize [on] register size specification ignored
Warns about a register with implicit size (such as \c{EAX}, which
is always 32 bits) been given an explicit size specification which
is inconsistent with the size of the named register, e.g. \c{WORD
EAX}. \c{DWORD EAX} or \c{WORD AX} are permitted, and do not
trigger this warning. Some registers which \e{do not} imply a
specific size, such as \c{K0}, may need this specification unless
the instruction itself implies the instruction size:
\c KMOVW K0,[foo] ; OK: KMOVW = 16 bits
\c KMOV WORD K0,[foo] ; OK: WORD K0 = 16 bits
\c KMOV K0,WORD [foo] ; OK: WORD [foo] = 16 bits
\c KMOV K0,[foo] ; Error: unknown size
reloc-abs-byte [off] 8-bit absolute section-crossing relocation
Warns that an 8-bit absolute relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-abs-dword [off] 32-bit absolute section-crossing relocation
Warns that a 32-bit absolute relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-abs-qword [off] 64-bit absolute section-crossing relocation
Warns that a 64-bit absolute relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-abs-word [off] 16-bit absolute section-crossing relocation
Warns that a 16-bit absolute relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-rel-byte [off] 8-bit relative section-crossing relocation
Warns that an 8-bit relative relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-rel-dword [off] 32-bit relative section-crossing relocation
Warns that a 32-bit relative relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-rel-qword [off] 64-bit relative section-crossing relocation
Warns that an 64-bit relative relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
reloc-rel-word [off] 16-bit relative section-crossing relocation
Warns that a 16-bit relative relocation that could
not be resolved at assembly time was generated in
the output format.
This is usually normal, but may not be handled by all
possible target environments
section-alignment-rounded [on] section alignment rounded up
Warn if a section alignment is specified which is
not supported by the underlying object format, but
can be rounded up to a supported value.
unknown-warning [off] unknown warning in \c{-W}/\c{-w} or warning directive
Warns about a \c{-w} or \c{-W} option or a \c{[WARNING]} directive
that contains an unknown warning name or is otherwise not possible
to process.
user [on] \c{%warning} directives
Controls output of \c{%warning} directives (see \k{pperror}).
warn-stack-empty [on] warning stack empty
A \c{[WARNING POP]} directive was executed when
the warning stack is empty. This is treated
as a \c{[WARNING *all]} directive.
#
# This warning is currently issued by backends, but in the future
# that code should be centralized.
#
zeroing [on] \c{RES}\e{x} in initialized section becomes zero
A \c{RES}\e{x} directive was used in a section which contains
initialized data, and the output format does not support
this. Instead, this will be replaced with explicit zero
content, which may produce a large output file.
zext-reloc [on] relocation zero-extended to match output format
Warns that a relocation has been zero-extended due
to limitations in the output format.