A1004: Macro nesting too deep. Possible recursion? Stop processing. (Set level with -MacroNest)

[DISABLE, INFORMATION, WARNING, ERROR]

Description

The macro expansion level was below the limit configured with the option -MacroNest.

Example

In the following example, "\2" was used instead of the indented "/2". "\2" is taken by the assembler as second argument, which is not present and therefore it is replaced with the empty argument. Therefore this example leads to an endless macro recursion.

  X_NOPS:   MACRO

    \@NofNops: EQU \1

            IF \@NofNops >= 1

               IF \@NofNops == 1

                  NOP

               ELSE

                  X_NOPS \@NofNops\2

                  X_NOPS \@NofNops-(\@NofNops\2)

               ENDIF

            ENDIF

          ENDM

          X_NOPS 17
  
Tips

Use the option -MacroNest to configure the macro expansion level. In the above example, use "/2" to get the correct macro:

  X_NOPS:   MACRO

    \@NofNops: EQU \1

            IF \@NofNops >= 1

               IF \@NofNops == 1

                  NOP

               ELSE

                  X_NOPS \@NofNops/2

                  X_NOPS \@NofNops-(\@NofNops/2)

               ENDIF

            ENDIF

          ENDM

          X_NOPS 17
  
See also

Option -MacroNest