diff options
author | Nicholas Clark <nick@ccl4.org> | 2002-11-07 14:58:14 +0000 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-12-09 00:25:26 +0000 |
commit | 1c2605ddeb2b70e312d1adf987f9c25ebbe9410b (patch) | |
tree | c57b9eddb559d8ba4f52cb672072c53cbf156088 /lib/ExtUtils/xsubpp | |
parent | 57a224e5764ead7e57b81a85c1724954c2c08e39 (diff) | |
download | perl-1c2605ddeb2b70e312d1adf987f9c25ebbe9410b.tar.gz |
[perl #18256] xsubpp can make nested comments in C code
From: Nicholas Clark (via RT) <perlbug@perl.org>
Message-Id: <rt-18256-41218.19.7625495305233@bugs6.perl.org>
p4raw-id: //depot/perl@18270
Diffstat (limited to 'lib/ExtUtils/xsubpp')
-rwxr-xr-x | lib/ExtUtils/xsubpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index 08df7e3446..647ffd78b5 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -907,7 +907,19 @@ while (<$FH>) { my $podstartline = $.; do { if (/^=cut\s*$/) { - print("/* Skipped embedded POD. */\n"); + # We can't just write out a /* */ comment, as our embedded + # POD might itself be in a comment. We can't put a /**/ + # comment inside #if 0, as the C standard says that the source + # file is decomposed into preprocessing characters in the stage + # before preprocessing commands are executed. + # I don't want to leave the text as barewords, because the spec + # isn't clear whether macros are expanded before or after + # preprocessing commands are executed, and someone pathological + # may just have defined one of the 3 words as a macro that does + # something strange. Multiline strings are illegal in C, so + # the "" we write must be a string literal. And they aren't + # concatenated until 2 steps later, so we are safe. + print("#if 0\n \"Skipped embedded POD.\"\n#endif\n"); printf("#line %d \"$filename\"\n", $. + 1) if $WantLineNumbers; next firstmodule |