From d235408c65fc8176fdd94dd9f7d49074828bfa86 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 27 Aug 2019 16:38:48 -0700 Subject: preproc: standard macros now C-safe, %aliases off, fix %? recursion Enough users expect the namespace starting with underscore to be safe for symbols. Change our private namespace from __foo__ to __?foo?__. Use %defalias to provide backwards compatiblity (by using %defalias instead of %define, we handle the case properly where the user changes the value.) Add a preprocessor directive: %aliases off ... to disable all smacro aliases and thereby making the namespace clean. Finally, fix infinite recursion when seeing %? or %?? due to paste_tokens(). If we don't paste anything, the expansion is done. Signed-off-by: H. Peter Anvin --- version.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'version.pl') diff --git a/version.pl b/version.pl index f6a9c7f7..634ad311 100755 --- a/version.pl +++ b/version.pl @@ -56,13 +56,13 @@ # NASM_VER -- whole version number as a string # # version.mac: -# __NASM_MAJOR__ -# __NASM_MINOR__ -# __NASM_SUBMINOR__ -# __NASM_PATCHLEVEL__ -# __NASM_SNAPSHOT__ -# __NASM_VERSION_ID__ -# __NASM_VER__ +# __?NASM_MAJOR?__ +# __?NASM_MINOR?__ +# __?NASM_SUBMINOR?__ +# __?NASM_PATCHLEVEL?__ +# __?NASM_SNAPSHOT?__ +# __?NASM_VERSION_ID?__ +# __?NASM_VER?__ # ($what) = @ARGV; @@ -148,15 +148,15 @@ if ( $what eq 'h' ) { print "#endif /* NASM_VERSION_H */\n"; } elsif ( $what eq 'mac' ) { print "STD: version\n"; - printf "%%define __NASM_MAJOR__ %d\n", $nmaj; - printf "%%define __NASM_MINOR__ %d\n", $nmin; - printf "%%define __NASM_SUBMINOR__ %d\n", $nsmin; - printf "%%define __NASM_PATCHLEVEL__ %d\n", $nplvl; + printf "%%define __?NASM_MAJOR?__ %d\n", $nmaj; + printf "%%define __?NASM_MINOR?__ %d\n", $nmin; + printf "%%define __?NASM_SUBMINOR?__ %d\n", $nsmin; + printf "%%define __?NASM_PATCHLEVEL?__ %d\n", $nplvl; if (defined($snapshot)) { - printf "%%define __NASM_SNAPSHOT__ %d\n", $snapshot; + printf "%%define __?NASM_SNAPSHOT?__ %d\n", $snapshot; } - printf "%%define __NASM_VERSION_ID__ 0%08Xh\n", $nasm_id; - printf "%%define __NASM_VER__ \"%s\"\n", $line; + printf "%%define __?NASM_VERSION_ID?__ 0%08Xh\n", $nasm_id; + printf "%%define __?NASM_VER?__ \"%s\"\n", $line; } elsif ( $what eq 'sed' ) { printf "s/\@\@NASM_MAJOR\@\@/%d/g\n", $nmaj; printf "s/\@\@NASM_MINOR\@\@/%d/g\n", $nmin; -- cgit v1.2.1