Bug 4708 - C++ VFS plugins cannot compile
Summary: C++ VFS plugins cannot compile
Status: NEW
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: VFS (show other bugs)
Version: 3.0.25a
Hardware: All All
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-18 11:48 UTC by gepardcv
Modified: 2007-06-18 11:48 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gepardcv 2007-06-18 11:48:32 UTC
This general problem affects 3.0.25a (and possibly 3.0.25, though I did not try it) and the current head of Subversion on the SAMBA_3_0 branch. VFS plugins written in C++ do not compile using g++ 4.1.2 because of C++ source incompatibilities introduced since version 3.0.24.

3.0.25a and HEAD:

/usr/src/samba-3.0.25a/source/include/rpc_svcctl.h:135: error: conflicting declaration typedef struct SERVICE_STATUS SERVICE_STATUS
/usr/src/samba-3.0.25a/source/librpc/gen_ndr/svcctl.h:24: error: struct SERVICE_STATUSâ has a previous declaration as struct SERVICE_STATUS

HEAD only:

/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1151: error: using typedef-name NET_R_DSR_GETDCNAME after struct
/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1135: error: NET_R_DSR_GETDCNAME has a previous declaration here
/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1151: error: invalid type in declaration before ; token
/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1170: error: using typedef-name NET_R_DSR_GETDCNAME after struct
/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1135: error: NET_R_DSR_GETDCNAME has a previous declaration here
/usr/src/samba-3.0.27pre-20070618/source/include/rpc_netlogon.h:1170: error: invalid type in declaration before ; token

I just used gross #ifndef __cplusplus directives to get around both problems. These patches work, but they may not be the right thing:


--- samba-3.0.27pre-20070618/source/include/rpc_svcctl.h        2007-05-31 13:59:04.000000000 -0400
+++ samba-3.0.27pre-20070615/source/include/rpc_svcctl.h        2007-06-15 18:54:19.000000000 -0400
@@ -121,19 +121,21 @@
 /* where we assume the location of the service control scripts */
 #define SVCCTL_SCRIPT_DIR  "svcctl"

 /* utility structures for RPCs */

+#ifndef __cplusplus
 typedef struct {
        uint32 type;
        uint32 state;
        uint32 controls_accepted;
        WERROR win32_exit_code;
        uint32 service_exit_code;
        uint32 check_point;
        uint32 wait_hint;
 } SERVICE_STATUS;
+#endif

 typedef struct {
        SERVICE_STATUS status;
        uint32 process_id;
        uint32 service_flags;



--- samba-3.0.27pre-20070618/source/include/rpc_netlogon.h      2007-06-08 06:29:46.000000000 -0400
+++ samba-3.0.27pre-20070615/source/include/rpc_netlogon.h      2007-06-15 18:53:06.000000000 -0400
@@ -1148,7 +1148,9 @@
 } NET_Q_DSR_GETDCNAMEEX;

 /* NET_R_DSR_GETDCNAMEEX */
+#ifndef __cplusplus
 typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX;
+#endif

 /* NET_Q_DSR_GETDCNAMEEX2 */
 typedef struct net_q_dsr_getdcnameex2 {
@@ -1167,7 +1169,9 @@
 } NET_Q_DSR_GETDCNAMEEX2;

 /* NET_R_DSR_GETDCNAMEEX */
+#ifndef __cplusplus
 typedef struct NET_R_DSR_GETDCNAME NET_R_DSR_GETDCNAMEEX2;
+#endif

 /* NET_Q_DSR_GESITENAME */
 typedef struct net_q_dsr_getsitename {