static const char **extrastdmac = NULL;
int any_extrastdmac;
+static int nested_mac_count, nested_rep_count;
+
/*
* Tokens are allocated in blocks to improve speed
*/
return NO_DIRECTIVE_FOUND;
}
+ if (defining) {
+ if (i == PP_MACRO || i == PP_IMACRO) {
+ nested_mac_count++;
+ return NO_DIRECTIVE_FOUND;
+ } else if (nested_mac_count > 0) {
+ if (i == PP_ENDMACRO) {
+ nested_mac_count--;
+ return NO_DIRECTIVE_FOUND;
+ }
+ }
+ if (!defining->name) {
+ if (i == PP_REP) {
+ nested_rep_count++;
+ return NO_DIRECTIVE_FOUND;
+ } else if (nested_rep_count > 0) {
+ if (i == PP_ENDREP) {
+ nested_rep_count--;
+ return NO_DIRECTIVE_FOUND;
+ }
+ }
+ }
+ }
+
if (j != -2)
{
error(ERR_NONFATAL, "unknown preprocessor directive `%s'",
nasm_src_set_linnum(0);
istk->lineinc = 1;
defining = NULL;
+ nested_mac_count = 0;
+ nested_rep_count = 0;
for (h = 0; h < NHASH; h++)
{
mmacros[h] = NULL;
EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.asm
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-bigint.hex
+EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.asm
+EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.errwarn
+EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp-nested.hex
EXTRA_DIST += modules/preprocs/nasm/tests/orgsect.asm
EXTRA_DIST += modules/preprocs/nasm/tests/orgsect.hex