aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-11-03 10:13:56 +0100
committerBjörn Gustavsson <[email protected]>2017-11-06 08:08:09 +0100
commitfe35a4f6a26a1242fef0b7d728403d162812679c (patch)
treedadfc9828b6f6974ae74353898601a211f513f88
parent6b5efa639ae8723745f860b793e74910c8d6798b (diff)
downloadotp-fe35a4f6a26a1242fef0b7d728403d162812679c.tar.gz
otp-fe35a4f6a26a1242fef0b7d728403d162812679c.tar.bz2
otp-fe35a4f6a26a1242fef0b7d728403d162812679c.zip
Clean up definition of built-in macros
Make it easier to define new macros.
-rwxr-xr-xerts/emulator/utils/beam_makeops11
1 files changed, 8 insertions, 3 deletions
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;
}