summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2013-02-06 10:17:57 +0200
committerKarolin Seeger <kseeger@samba.org>2013-08-12 09:09:44 +0200
commitb07ade6e6fcc8b844cf1fb8b6038617281c4c2d0 (patch)
tree62b1f336b9e7995a566b77517ce10fd105103440
parent5d6f7502e34fa25c146b28ecacf49841b8f2c7f7 (diff)
downloadsamba-b07ade6e6fcc8b844cf1fb8b6038617281c4c2d0.tar.gz
PIDL: fix parsing linemarkers in preprocessor output
When PIDL calls out to C preprocessor to expand IDL files and parse the output, it filters out linemarkers and line control information as described in http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html and http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html#Line-Control With gcc 4.8 stdc-predef.h is included automatically and linemarker for the file has extended flags that PIDL couldn't parse ('system header that needs to be extern "C" protected for C++') Thanks to Jakub Jelinek <jakub@redhat.com> for explanation of the linemarker format. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=906517 Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 6ba7ab5c14801aecae96373d5a9db7ab82957526) Signed-off-by: Andreas Schneider <asn@samba.org> Fix bug #9636 - pidl can't parse new linemarkers in preprocessor output. (cherry picked from commit 643571470f2e4cd2f58bd60ac7189abb826d33cc) (cherry picked from commit b5a8afd6550e9091d169d3010751913bb483fc4b)
-rw-r--r--pidl/idl.yp4
-rw-r--r--pidl/lib/Parse/Pidl/IDL.pm4
2 files changed, 6 insertions, 2 deletions
diff --git a/pidl/idl.yp b/pidl/idl.yp
index b5c5185fbe1..c8a65f6f629 100644
--- a/pidl/idl.yp
+++ b/pidl/idl.yp
@@ -610,7 +610,9 @@ again:
for ($parser->YYData->{INPUT}) {
if (/^\#/) {
- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
+ # Linemarker format is described at
+ # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
+ if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
$parser->YYData->{LINE} = $1-1;
$parser->YYData->{FILE} = $2;
goto again;
diff --git a/pidl/lib/Parse/Pidl/IDL.pm b/pidl/lib/Parse/Pidl/IDL.pm
index d4820ffe92c..6927c892556 100644
--- a/pidl/lib/Parse/Pidl/IDL.pm
+++ b/pidl/lib/Parse/Pidl/IDL.pm
@@ -2576,7 +2576,9 @@ again:
for ($parser->YYData->{INPUT}) {
if (/^\#/) {
- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
+ # Linemarker format is described at
+ # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
+ if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
$parser->YYData->{LINE} = $1-1;
$parser->YYData->{FILE} = $2;
goto again;