>Number:         165559
>Category:       kern
>Synopsis:       ufsmount.h uses the 'export' keyword as a structure member name
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 29 17:50:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Jim C.
>Release:        8.2-RELEASE-p4
>Organization:
Carroll-Net, Inc.
>Environment:
FreeBSD bv601.hck.carroll.com 8.2-RELEASE-p4 FreeBSD 8.2-RELEASE-p4 #0: Fri Nov 
18 15:50:11 EST 2011


>Description:
While compiling some GNU C++ code against the include file 
/usr/include/ufs/ufs/ufsmount.h, we discovered the ufs_args structure has a 
member variable named 'export'. G++ chokes with the following error:

/usr/include/ufs/ufs/ufsmount.h:43: error: expected unqualified-id before 
'export'

The reason is that the term 'export' is a reserved, but presently unused 
keyword in the C++ language.

To solve our problem, we've copied the header locally to our project folder, 
and renamed the reference. But if possible, I was hoping this could be folded 
back into the main tree.

I recognize this could present a breaking change for any projects that link 
against libufs -- but sooner or later this change will need to be accepted or 
someone is going to have to convince the folks at GNU/C++ to add a compiler 
directive to ignore the 'export' keyword (fyi -- I checked, but so far this 
looks like a no go).

FYI -- the folks at the openssl project encountered had a similar problem and 
eventually they were forced to just rename the member variable.
>How-To-Repeat:
Create my.cpp, paste in

    #include <sys/param.h>
    #include <sys/mount.h>
    #include <ufs/ufs/ufsmount.h>
    #include <ufs/ufs/dinode.h>
    #include <ufs/ffs/fs.h>
    #include <libufs.h>

g++ -c my.cpp
~
~

>Fix:
--- ufsmount.h  2012-02-29 12:33:04.000000000 -0500
+++ /usr/include/ufs/ufs/ufsmount.h     2012-02-29 12:32:28.000000000 -0500
@@ -40,7 +40,7 @@
  */
 struct ufs_args {
        char    *fspec;                 /* block special device to mount */
-       struct  oexport_args export_;   /* network export information */
+       struct  oexport_args export;    /* network export information */
 };
 
 #ifdef _KERNEL


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to