summaryrefslogtreecommitdiff
path: root/nasmlib.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-04-10 14:56:09 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-04-10 14:56:09 -0700
commit72ec0e414453d9d036a932b60939467c81582e14 (patch)
treec4757d7cd09bc49f4f01367a0ae595722dd11b5a /nasmlib.h
parent2746b624fbbbdd4af3262d6c9bb09d62624f4998 (diff)
downloadnasm-72ec0e414453d9d036a932b60939467c81582e14.tar.gz
Temporaries in macros need a unique prefix; WSAA*() macros to header
When using temporaries in macros, given them a unique prefix to avoid namespace collisions when using one macro inside another. Move the WSAA*() macros from outelf32/outelf64 to a separate header file.
Diffstat (limited to 'nasmlib.h')
-rw-r--r--nasmlib.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/nasmlib.h b/nasmlib.h
index ed628c7f..2f9f87dd 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -206,8 +206,8 @@ void standard_extension(char *inname, char *outname, char *extension,
#define WRITEADDR(p,v,s) \
do { \
- uint64_t _v = (v); \
- memcpy((p), &_v, (s)); \
+ uint64_t _wa_v = (v); \
+ memcpy((p), &_wa_v, (s)); \
(p) += (s); \
} while (0)
@@ -215,54 +215,54 @@ void standard_extension(char *inname, char *outname, char *extension,
#define WRITECHAR(p,v) \
do { \
- uint8_t *_p = (uint8_t *)(p); \
- uint8_t _v = (v); \
- _p[0] = _v; \
- (p) = (void *)(_p + 1); \
+ uint8_t *_wc_p = (uint8_t *)(p); \
+ uint8_t _wc_v = (v); \
+ _wc_p[0] = _wc_v; \
+ (p) = (void *)(_wc_p + 1); \
} while (0)
#define WRITESHORT(p,v) \
do { \
- uint8_t *_p = (uint8_t *)(p); \
- uint16_t _v = (v); \
- _p[0] = _v; \
- _p[1] = _v >> 8; \
- (p) = (void *)(_p + 2); \
+ uint8_t *_ws_p = (uint8_t *)(p); \
+ uint16_t _ws_v = (v); \
+ _ws_p[0] = _ws_v; \
+ _ws_p[1] = _ws_v >> 8; \
+ (p) = (void *)(_ws_p + 2); \
} while (0)
#define WRITELONG(p,v) \
do { \
- uint8_t *_p = (uint8_t *)(p); \
- uint32_t _v = (v); \
- _p[0] = _v; \
- _p[1] = _v >> 8; \
- _p[2] = _v >> 16; \
- _p[3] = _v >> 24; \
- (p) = (void *)(_p + 4); \
+ uint8_t *_wl_p = (uint8_t *)(p); \
+ uint32_t _wl_v = (v); \
+ _wl_p[0] = _wl_v; \
+ _wl_p[1] = _wl_v >> 8; \
+ _wl_p[2] = _wl_v >> 16; \
+ _wl_p[3] = _wl_v >> 24; \
+ (p) = (void *)(_wl_p + 4); \
} while (0)
#define WRITEDLONG(p,v) \
do { \
- uint8_t *_p = (uint8_t *)(p); \
- uint64_t _v = (v); \
- _p[0] = _v; \
- _p[1] = _v >> 8; \
- _p[2] = _v >> 16; \
- _p[3] = _v >> 24; \
- _p[4] = _v >> 32; \
- _p[5] = _v >> 40; \
- _p[6] = _v >> 48; \
- _p[7] = _v >> 56; \
- (p) = (void *)(_p + 8); \
+ uint8_t *_wq_p = (uint8_t *)(p); \
+ uint64_t _wq_v = (v); \
+ _wq_p[0] = _wq_v; \
+ _wq_p[1] = _wq_v >> 8; \
+ _wq_p[2] = _wq_v >> 16; \
+ _wq_p[3] = _wq_v >> 24; \
+ _wq_p[4] = _wq_v >> 32; \
+ _wq_p[5] = _wq_v >> 40; \
+ _wq_p[6] = _wq_v >> 48; \
+ _wq_p[7] = _wq_v >> 56; \
+ (p) = (void *)(_wq_p + 8); \
} while (0)
#define WRITEADDR(p,v,s) \
do { \
- int _s = (s); \
- uint64_t _v = (v); \
- while (_s--) { \
- WRITECHAR(p,_v); \
- _v >>= 8; \
+ int _wa_s = (s); \
+ uint64_t _wa_v = (v); \
+ while (_wa_s--) { \
+ WRITECHAR(p,_wa_v); \
+ _wa_v >>= 8; \
} \
} while(0)