preproc: Revert to the NASM 2.09 preprocessor

The NASM 2.09 preprocessor allows some illogical constructs, but which
unfortunately has been found in real code in the field.  We need
a compatibility solution or a pragma before we can avoid that.

However, we need the other features in NASM 2.10 to come out, so
revert the preprocessor changes for now.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2012-03-03 16:14:51 -08:00
parent 500ddabcd3
commit 36206cd378
4 changed files with 961 additions and 1347 deletions

View file

@ -9,24 +9,6 @@ since 2007.
\S{cl-2.10} Version 2.10
\b Support for delayed preprocessing \c{%final}
See \k{final}.
\b Support for comment blocks \c{%comment}.
See \k{comment}.
\b Support for arbitrarily terminating conditional loops \c{%exitwhile}.
See \k{exitwhile}.
\b Support for conditional loops \c{%while}.
See \k{while}.
\b Support for arbitrarily terminating macro expansions \c{%exitmacro}.
See \k{exitmacro}.
\b Support for recursive macro expansion \c{%rmacro}/\c{%irmacro}.
See \k{mlrmacro}.
\b When optimization is enabled, \c{mov r64,imm} now optimizes to the
shortest form possible between:
@ -47,8 +29,6 @@ To force a specific form, use the \c{STRICT} keyword, see \k{strict}.
\b Add support for bigendian UTF-16 and UTF-32. See \k{unicode}.
\b Fixed problem with paste of an empty ending token. See \k{concat%+}.
\S{cl-2.09.10} Version 2.09.10
\b Fix up NSIS script to protect uninstaller against registry keys

View file

@ -2427,22 +2427,6 @@ things like
\c silly {13,10}, crlf ; crlf: db 13,10
\S{mlrmacro} \i{Recursive Multi-Line Macros}: \I\c{%irmacro}\i\c{%rmacro}
A multi-line macro cannot be referenced within itself, in order to
prevent accidental infinite recursion and allow instruction overloading.
Recursive multi-line macros allow for self-referencing, with the
caveat that the user is aware of the existence, use and purpose of
recursive multi-line macros. There is also a generous, but sane, upper
limit to the number of recursions, in order to prevent run-away memory
consumption in case of accidental infinite recursion.
As with non-recursive multi-line macros, recursive multi-line macros are
\i{case-sensitive}, unless you define them using the alternative
directive \c{%irmacro}.
\S{mlmacover} Overloading Multi-Line Macros\I{overloading, multi-line macros}
As with single-line macros, multi-line macros can be overloaded by
@ -2900,22 +2884,6 @@ does \e{not} remove the macro \c{bar}, since the argument
specification does not match exactly.
\S{exitmacro} Exiting Multi-Line Macros: \i\c{%exitmacro}
Multi-line macro expansions can be arbitrarily terminated with
the \c{%exitmacro} directive.
For example:
\c %macro foo 1-3
\c ; Do something
\c %if<condition>
\c %exitmacro
\c %endif
\c ; Do something
\c %endmacro
\H{condasm} \i{Conditional Assembly}\I\c{%if}
Similarly to the C preprocessor, NASM allows sections of a source
@ -3235,31 +3203,6 @@ Note a maximum repeat count is limited by 62 bit number, though it
is hardly possible that you ever need anything bigger.
\H{while} \i{Conditional Loops}: \i\c{%while}
The directives \c{%while} and \i\c{%endwhile} combine preprocessor
loops with conditional assembly, allowing the enclosed chunk of
code to be replicated as long as certain conditions are met:
\c %while<condition>
\c ; some code which only repeats while <condition> is met
\c %endwhile
\S{exitwhile} Exiting Conditional Loops: \i\c{%exitwhile}
Conditional loops can be arbitrarily terminated with the
\i\c{%exitwhile} directive.
For example:
\c %while<condition>
\c %if<some other condition>
\c %exitwhile
\c %endif
\c ; some code which only repeats while <condition> is met
\c %endwhile
\H{files} Source Files and Dependencies
These commands allow you to split your sources into multiple files.
@ -3832,14 +3775,6 @@ variable, for example:
\c %defstr C_colon %!'C:'
\S{final} \i\c{%final} Directive
The \c{%final} directive is used to delay preprocessing of a line
until all other "normal" preprocessing is complete. Multiple
\c{%final} directives are processed in the opposite order of their
declaration, last one first and first one last.
\H{comment} Comment Blocks: \i\c{%comment}
The \c{%comment} and \c{%endcomment} directives are used to specify

View file

@ -50,25 +50,20 @@
%arg
%assign
%clear
%comment
%define
%defstr
%deftok
%depend
%elif*
%else
%endcomment
%endif
%endm
%endmacro
%endrep
%endwhile
%error
%exitmacro
%exitrep
%exitwhile
%fatal
%final
%iassign
%idefine
%idefstr
@ -97,5 +92,4 @@
%unmacro
%use
%warning
%while*
%xdefine

2217
preproc.c

File diff suppressed because it is too large Load diff