summaryrefslogtreecommitdiff
path: root/Porting/expand-macro.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-12-07 11:26:29 +0100
committerNicholas Clark <nick@ccl4.org>2011-12-07 11:26:29 +0100
commitae2e176f7be6c85a6339a59bda00ae2f36d09397 (patch)
treec33ad3d574f311d6a2d47a5e2ce797412879f299 /Porting/expand-macro.pl
parent673699fed0c089f7819da8740d236474460a3d91 (diff)
downloadperl-ae2e176f7be6c85a6339a59bda00ae2f36d09397.tar.gz
Porting/expand-macro.pl needs to avoid "macro redefined" errors.
In the C code that Porting/expand-macro.pl generates, it #includes the header containing the macro, to ensure that the macro definition is seen. This was skipped for perl.h and EXTERN.h, which it always automatically includes. However, perl.h includes embed.h and embedvar.h and then undefines and redefines macros in them. Hence if either header is included (again) the compiler warns about macro redefinitions. Hence ensure that neither is included a second time.
Diffstat (limited to 'Porting/expand-macro.pl')
-rwxr-xr-xPorting/expand-macro.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/Porting/expand-macro.pl b/Porting/expand-macro.pl
index 6b33f74513..f422a44dcf 100755
--- a/Porting/expand-macro.pl
+++ b/Porting/expand-macro.pl
@@ -62,7 +62,9 @@ open my $out, '>', $trysource or die "Can't open $trysource: $!";
my $sentinel = "$macro expands to";
-my %done_header;
+# These two are included from perl.h, and perl.h sometimes redefines their
+# macros. So no need to include them.
+my %done_header = ('embed.h' => 1, 'embedvar.h' => 1);
sub do_header {
my $header = shift;