summaryrefslogtreecommitdiff
path: root/version.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-08-27 16:38:48 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-08-27 16:42:41 -0700
commitd235408c65fc8176fdd94dd9f7d49074828bfa86 (patch)
tree1c1813452456e38e4af96a9046b96ac0e4b43998 /version.pl
parenteaef851689e1d83608741cd5ac7c65e4e47d4acb (diff)
downloadnasm-d235408c65fc8176fdd94dd9f7d49074828bfa86.tar.gz
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 <hpa@zytor.com>
Diffstat (limited to 'version.pl')
-rwxr-xr-xversion.pl28
1 files changed, 14 insertions, 14 deletions
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;