From fe35a4f6a26a1242fef0b7d728403d162812679c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 3 Nov 2017 10:13:56 +0100 Subject: Clean up definition of built-in macros Make it easier to define new macros. --- erts/emulator/utils/beam_makeops | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'erts/emulator/utils') diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops index 02227bbdfd..296fbc9d5f 100755 --- a/erts/emulator/utils/beam_makeops +++ b/erts/emulator/utils/beam_makeops @@ -306,9 +306,14 @@ if ($wordsize == 64) { # Add placeholders for built-in macros. # -$c_code{'IS_PACKED'} = ['$Expr',"built-in macro",('Expr')]; -$c_code{'ARG_POSITION'} = ['$Expr',"built-in macro",('Expr')]; -foreach my $name (keys %c_code) { +my %predef_macros = + (IS_PACKED => ['Expr'], + ARG_POSITION => ['Expr'], + ); +foreach my $name (keys %predef_macros) { + my @args = @{$predef_macros{$name}}; + my $body = join(':', map { '$' . $_ } @args); + $c_code{$name} = [$body,"built-in macro",@args], $c_code_used{$name} = 1; } -- cgit v1.2.3