diff options
author | H. Peter Anvin <hpa@zytor.com> | 2019-08-27 16:38:48 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2019-08-27 16:42:41 -0700 |
commit | d235408c65fc8176fdd94dd9f7d49074828bfa86 (patch) | |
tree | 1c1813452456e38e4af96a9046b96ac0e4b43998 /output | |
parent | eaef851689e1d83608741cd5ac7c65e4e47d4acb (diff) | |
download | nasm-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 'output')
-rw-r--r-- | output/outaout.mac | 4 | ||||
-rw-r--r-- | output/outas86.mac | 4 | ||||
-rw-r--r-- | output/outbin.mac | 4 | ||||
-rw-r--r-- | output/outcoff.mac | 4 | ||||
-rw-r--r-- | output/outdbg.mac | 4 | ||||
-rw-r--r-- | output/outelf.mac | 4 | ||||
-rw-r--r-- | output/outmacho.mac | 8 | ||||
-rw-r--r-- | output/outobj.mac | 4 | ||||
-rw-r--r-- | output/outrdf.mac | 4 | ||||
-rw-r--r-- | output/outrdf2.mac | 4 |
10 files changed, 22 insertions, 22 deletions
diff --git a/output/outaout.mac b/output/outaout.mac index cd23852d..5b7b3668 100644 --- a/output/outaout.mac +++ b/output/outaout.mac @@ -32,6 +32,6 @@ ;; -------------------------------------------------------------------------- OUT: aout aoutb -%define __SECT__ [section .text] -%macro __NASM_CDecl__ 1 +%define __?SECT?__ [section .text] +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outas86.mac b/output/outas86.mac index f0bd2e41..f7c9a489 100644 --- a/output/outas86.mac +++ b/output/outas86.mac @@ -32,6 +32,6 @@ ;; -------------------------------------------------------------------------- OUT: as86 -%define __SECT__ [section .text] -%macro __NASM_CDecl__ 1 +%define __?SECT?__ [section .text] +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outbin.mac b/output/outbin.mac index be7fefae..99c15b6a 100644 --- a/output/outbin.mac +++ b/output/outbin.mac @@ -32,9 +32,9 @@ ;; -------------------------------------------------------------------------- OUT: bin -%define __SECT__ [section .text] +%define __?SECT?__ [section .text] %imacro org 1+.nolist [org %1] %endmacro -%macro __NASM_CDecl__ 1 +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outcoff.mac b/output/outcoff.mac index 2b8b12ff..8d338efa 100644 --- a/output/outcoff.mac +++ b/output/outcoff.mac @@ -32,8 +32,8 @@ ;; -------------------------------------------------------------------------- OUT: coff win32 win64 -%define __SECT__ [section .text] -%macro __NASM_CDecl__ 1 +%define __?SECT?__ [section .text] +%macro __?NASM_CDecl?__ 1 %endmacro %imacro export 1+.nolist [export %1] diff --git a/output/outdbg.mac b/output/outdbg.mac index 4f68d63c..af7d274c 100644 --- a/output/outdbg.mac +++ b/output/outdbg.mac @@ -36,7 +36,7 @@ ; for the .obj format. ; OUT: dbg -%define __SECT__ [section .text] +%define __?SECT?__ [section .text] %imacro group 1+.nolist [group %1] %endmacro @@ -49,5 +49,5 @@ OUT: dbg %imacro import 1+.nolist %pragma dbg import %1 %endmacro -%macro __NASM_CDecl__ 1 +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outelf.mac b/output/outelf.mac index 6994d077..94babe30 100644 --- a/output/outelf.mac +++ b/output/outelf.mac @@ -32,8 +32,8 @@ ;; -------------------------------------------------------------------------- OUT: elf elf32 elf64 -%define __SECT__ [section .text] -%macro __NASM_CDecl__ 1 +%define __?SECT?__ [section .text] +%macro __?NASM_CDecl?__ 1 %define $_%1 $%1 %endmacro %imacro osabi 1+.nolist diff --git a/output/outmacho.mac b/output/outmacho.mac index 52ce3d27..001bb3a0 100644 --- a/output/outmacho.mac +++ b/output/outmacho.mac @@ -32,18 +32,18 @@ ;; -------------------------------------------------------------------------- OUT: macho macho32 macho64 -%define __SECT__ [section .text] -%macro __NASM_CDecl__ 1 +%define __?SECT?__ [section .text] +%macro __?NASM_CDecl?__ 1 %endmacro ; This directive sets the MH_SUBSECTIONS_VIA_SYMBOLS header flag %imacro subsections_via_symbols 0.nolist - %pragma __OUTPUT_FORMAT__ %? + %pragma __?OUTPUT_FORMAT?__ %? %endmacro %imacro no_dead_strip 1-*.nolist %rep %0 - %pragma __OUTPUT_FORMAT__ %? %1 + %pragma __?OUTPUT_FORMAT?__ %? %1 %rotate 1 %endrep %endmacro diff --git a/output/outobj.mac b/output/outobj.mac index a5da833e..09158f23 100644 --- a/output/outobj.mac +++ b/output/outobj.mac @@ -32,7 +32,7 @@ ;; -------------------------------------------------------------------------- OUT: obj -%define __SECT__ [section .text] +%define __?SECT?__ [section .text] %imacro group 1+.nolist [group %1] %endmacro @@ -45,5 +45,5 @@ OUT: obj %imacro import 1+.nolist [import %1] %endmacro -%macro __NASM_CDecl__ 1 +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outrdf.mac b/output/outrdf.mac index 64a7ac14..b318329a 100644 --- a/output/outrdf.mac +++ b/output/outrdf.mac @@ -32,9 +32,9 @@ ;; -------------------------------------------------------------------------- OUT: rdf -%define __SECT__ [section .text] +%define __?SECT?__ [section .text] %imacro library 1+.nolist [library %1] %endmacro -%macro __NASM_CDecl__ 1 +%macro __?NASM_CDecl?__ 1 %endmacro diff --git a/output/outrdf2.mac b/output/outrdf2.mac index 4875c50c..5e9166e6 100644 --- a/output/outrdf2.mac +++ b/output/outrdf2.mac @@ -32,12 +32,12 @@ ;; -------------------------------------------------------------------------- OUT: rdf2 -%define __SECT__ [section .text] +%define __?SECT?__ [section .text] %imacro library 1+.nolist [library %1] %endmacro %imacro module 1+.nolist [module %1] %endmacro -%macro __NASM_CDecl__ 1 +%macro __?NASM_CDecl?__ 1 %endmacro |