Fix pidl code generation with gcc 4.8.
authorAndreas Schneider <asn@cryptomilk.org>
Thu, 7 Feb 2013 15:02:28 +0000 (16:02 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 7 Feb 2013 15:11:14 +0000 (16:11 +0100)
resolves: #906517

samba-4.0.3-fix_pidl_with_gcc48.patch [new file with mode: 0644]
samba.spec

diff --git a/samba-4.0.3-fix_pidl_with_gcc48.patch b/samba-4.0.3-fix_pidl_with_gcc48.patch
new file mode 100644 (file)
index 0000000..cb2378a
--- /dev/null
@@ -0,0 +1,60 @@
+From 1ac743a7d0d20e16fc325749d593edaaed89d706 Mon Sep 17 00:00:00 2001
+From: Alexander Bokovoy <ab@samba.org>
+Date: Wed, 6 Feb 2013 10:17:57 +0200
+Subject: [PATCH] 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>
+---
+ pidl/idl.yp                | 4 +++-
+ pidl/lib/Parse/Pidl/IDL.pm | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/pidl/idl.yp b/pidl/idl.yp
+index b5c5185..c8a65f6 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 d4820ff..6927c89 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;
+-- 
+1.8.1.1
+
index 75d010d4b36ab748ca8596d40e6644f012b0374f..82dcabaf6cdd99affcc52e34614b74daed0030f9 100644 (file)
@@ -76,6 +76,8 @@ Source6: samba.pamd
 Source200: README.dc
 Source201: README.downgrade
 
+Patch0: samba-4.0.3-fix_pidl_with_gcc48.patch
+
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 Requires(pre): /usr/sbin/groupadd
@@ -430,6 +432,8 @@ the local kerberos library to use the same KDC as samba and winbind use
 %prep
 %setup -q -n samba-%{version}%{pre_release}
 
+%patch0 -p1 -b .pidl_gcc48
+
 %build
 %global _talloc_lib ,talloc,pytalloc,pytalloc-util
 %global _tevent_lib ,tevent,pytevent
@@ -1341,6 +1345,7 @@ rm -rf %{buildroot}
 * Thu Feb 07 2013 - Andreas Schneider <asn@redhat.com> - 2:4.0.3-1
 - Update to Samba 4.0.3.
 - resolves: #907544 - Add unowned directory /usr/lib64/samba.
+- resolves: #906517 - Fix pidl code generation with gcc 4.8.
 
 * Wed Jan 30 2013 - Andreas Schneider <asn@redhat.com> - 2:4.0.2-1
 - Update to Samba 4.0.2.