From: Hugo van der Sanden Date: Wed, 28 Nov 2001 21:47:59 +0000 (+0000) Subject: Re: More h2ph problems [was Re: h2ph confused by comments in an enum. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=edf6e4ec734b175d478b17f1da78d9e6fe60025e;p=p5sagit%2Fp5-mst-13.2.git Re: More h2ph problems [was Re: h2ph confused by comments in an enum. Message-Id: <200111282147.fASLlxD04163@crypt.compulink.co.uk> p4raw-id: //depot/perl@13355 --- diff --git a/t/lib/h2ph.h b/t/lib/h2ph.h index f12a677..c60e8f0 100644 --- a/t/lib/h2ph.h +++ b/t/lib/h2ph.h @@ -98,6 +98,13 @@ typedef enum _days_of_week { sun, mon, tue, wed, thu, fri, sat, Sun=0, Mon, ??= define SOMETHING_ELSE_TRIGRAPHIC_8 "??>" /* | ??>| }| */ ??=endif +// test C++-style comment + +#if 1 +typdef struct empty_struct { +} // trailing C++-style comment should not force continuation +#endif + /* comments (that look like string) inside enums... */ enum { diff --git a/t/lib/h2ph.pht b/t/lib/h2ph.pht index 235332d..a52c160 100644 --- a/t/lib/h2ph.pht +++ b/t/lib/h2ph.pht @@ -79,6 +79,8 @@ unless(defined(&_H2PH_H_)) { eval 'sub SOMETHING_ELSE_TRIGRAPHIC_7 () {"#";}' unless defined(&SOMETHING_ELSE_TRIGRAPHIC_7); eval 'sub SOMETHING_ELSE_TRIGRAPHIC_8 () {"}";}' unless defined(&SOMETHING_ELSE_TRIGRAPHIC_8); } + if(1) { + } eval("sub flim () { 0; }") unless defined(&flim); eval("sub flam () { 1; }") unless defined(&flam); } diff --git a/utils/h2ph.PL b/utils/h2ph.PL index 4dab916..901f0bb 100644 --- a/utils/h2ph.PL +++ b/utils/h2ph.PL @@ -438,7 +438,7 @@ sub next_line } elsif ($in =~ s/^("(\\.|[^"\\])*")//) { # "... $out .= $1; } elsif ($in =~ s/^\/\/.*//) { # //... - next READ; + # fall through } elsif ($in =~ m/^\/\*/) { # /*... # C comment removal adapted from perlfaq6: if ($in =~ s/^\/\*[^*]*\*+([^\/*][^*]*\*+)*\///) { @@ -455,7 +455,7 @@ sub next_line } } - last READ; + last READ if $out =~ /\S/; } return $out;