Fix and improve large_readx handling for broken clients.
[ira/fedora-git] / samba-4.0.3-fix_pidl_with_gcc48.patch
1 From 1ac743a7d0d20e16fc325749d593edaaed89d706 Mon Sep 17 00:00:00 2001
2 From: Alexander Bokovoy <ab@samba.org>
3 Date: Wed, 6 Feb 2013 10:17:57 +0200
4 Subject: [PATCH] PIDL: fix parsing linemarkers in preprocessor output
5
6 When PIDL calls out to C preprocessor to expand IDL files
7 and parse the output, it filters out linemarkers and line control
8 information as described in http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
9 and http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html#Line-Control
10
11 With gcc 4.8 stdc-predef.h is included automatically and linemarker for the
12 file has extended flags that PIDL couldn't parse ('system header that needs to
13 be extern "C" protected for C++')
14
15 Thanks to Jakub Jelinek <jakub@redhat.com> for explanation of the linemarker format.
16
17 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=906517
18
19 Reviewed-by: Andreas Schneider <asn@samba.org>
20 (cherry picked from commit 6ba7ab5c14801aecae96373d5a9db7ab82957526)
21
22 Signed-off-by: Andreas Schneider <asn@samba.org>
23 ---
24  pidl/idl.yp                | 4 +++-
25  pidl/lib/Parse/Pidl/IDL.pm | 4 +++-
26  2 files changed, 6 insertions(+), 2 deletions(-)
27
28 diff --git a/pidl/idl.yp b/pidl/idl.yp
29 index b5c5185..c8a65f6 100644
30 --- a/pidl/idl.yp
31 +++ b/pidl/idl.yp
32 @@ -610,7 +610,9 @@ again:
33  
34         for ($parser->YYData->{INPUT}) {
35                 if (/^\#/) {
36 -                       if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
37 +                       # Linemarker format is described at
38 +                       # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
39 +                       if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
40                                 $parser->YYData->{LINE} = $1-1;
41                                 $parser->YYData->{FILE} = $2;
42                                 goto again;
43 diff --git a/pidl/lib/Parse/Pidl/IDL.pm b/pidl/lib/Parse/Pidl/IDL.pm
44 index d4820ff..6927c89 100644
45 --- a/pidl/lib/Parse/Pidl/IDL.pm
46 +++ b/pidl/lib/Parse/Pidl/IDL.pm
47 @@ -2576,7 +2576,9 @@ again:
48  
49         for ($parser->YYData->{INPUT}) {
50                 if (/^\#/) {
51 -                       if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
52 +                       # Linemarker format is described at
53 +                       # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
54 +                       if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
55                                 $parser->YYData->{LINE} = $1-1;
56                                 $parser->YYData->{FILE} = $2;
57                                 goto again;
58 -- 
59 1.8.1.1
60