From: Alexander Bokovoy Date: Wed, 6 Feb 2013 08:17:57 +0000 (+0200) Subject: PIDL: fix parsing linemarkers in preprocessor output X-Git-Tag: tevent-0.9.18~284 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=6ba7ab5c14801aecae96373d5a9db7ab82957526;p=samba.git 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 for explanation of the linemarker format. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=906517 Reviewed-by: Andreas Schneider --- 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;