From nobody@FreeBSD.ORG  Sat Jan  8 03:09:15 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 0394814CC1; Sat,  8 Jan 2000 03:09:14 -0800 (PST)
Message-Id: <20000108110914.0394814CC1@hub.freebsd.org>
Date: Sat,  8 Jan 2000 03:09:14 -0800 (PST)
From: afo@zlug.org
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: C++ keywords in kernel header files
X-Send-Pr-Version: www-1.0

>Number:         15983
>Category:       kern
>Synopsis:       C++ keywords in kernel header files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan  8 03:10:01 PST 2000
>Closed-Date:    Fri Jun 20 17:22:00 PDT 2003
>Last-Modified:  Fri Jun 20 17:22:00 PDT 2003
>Originator:     Andre Fornacon
>Release:        FreeBSD 3.3R
>Organization:
zLUG
>Environment:
FreeBSD rox.zlug.org 3.3-RELEASE FreeBSD 3.3-RELEASE #16: Fri Jan  7 18:52:41 CET 2000     root@rox.zlug.org:/usr/src/sys/compile/ROX  i386
>Description:
use of c++ keyword 'class' in kernel header file 
dev/sub/usb.h, around line 496 in struct usb_device_info
i this need this header file for application programming.

problem affects current kernel source - cvsup'd 2000/01/08 - too 

i hope the included patch catches all access of the class field
of struct usb_device_info

>How-To-Repeat:
compile the following sample code with g++ -I/src/sys/dev -c main.c:
-- begin main.c --
#include <usb/usb.h>
-- end main.c --

compile gives:
In file included from main.c:1:
/usr/src/sys/dev/usb/usb.h:476: parse error before `;'

>Fix:
cvs diff: Diffing .
Index: usb.h
===================================================================
RCS file: /home/FreeBSD/CURRENT/src/sys/dev/usb/usb.h,v
retrieving revision 1.17
diff -u -r1.17 usb.h
--- usb.h       1999/12/29 04:35:47     1.17
+++ usb.h       2000/01/01 18:16:27
@@ -489,7 +489,7 @@
        u_int16_t       productNo;                      /* idProduct */
        u_int16_t       vendorNo;                       /* idVendor */
        u_int16_t       releaseNo;                      /* bcdDevice */
-       u_int8_t        class;                          /* bDeviceClass */
+       u_int8_t        clazz;                          /* bDeviceClass */
        u_int8_t        subclass;                       /* bDeviceSubclass */
        u_int8_t        protocol;                       /* bDeviceProtocol */
        u_int8_t        config;                         /* config index */
Index: usb_subr.c
===================================================================
RCS file: /home/FreeBSD/CURRENT/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.21
diff -u -r1.21 usb_subr.c
--- usb_subr.c  1999/12/03 08:41:11     1.21
+++ usb_subr.c  2000/01/08 11:53:17
@@ -1160,7 +1160,7 @@
        di->vendorNo = UGETW(dev->ddesc.idVendor);
        di->productNo = UGETW(dev->ddesc.idProduct);
        di->releaseNo = UGETW(dev->ddesc.bcdDevice);
-       di->class = dev->ddesc.bDeviceClass;
+       di->clazz = dev->ddesc.bDeviceClass;
        di->subclass = dev->ddesc.bDeviceSubClass;
        di->protocol = dev->ddesc.bDeviceProtocol;
        di->config = dev->config;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Sun Jan 9 16:00:30 PST 2000 
Responsible-Changed-Why:  
usb.h is mine. 


From: Daniel Hagan <dhagan@cs.vt.edu>
To: afo@zlug.org
Cc: n_hibma@freebsd.org, freebsd-gnats-submit@freebsd.org
Subject: Re: kern/15983: C++ keyword in header file
Date: Tue, 18 Jan 2000 11:19:44 -0500 (EST)

 Why not wrap your application level include in an extern "C" construct?  
 It seems like this would make more sense (as the kernel is written in C,
 and you're the one importing it into a C++ context).  I don't see any
 reason to make the kernel's C-coders responsible for C++ compatibility, do
 you?
 
 Daniel
 
 -- 
 Daniel Hagan                                             Computer Science CSE
 dhagan@cs.vt.edu                                http://www.cs.vt.edu/~dhagan/
 
 

From: Nick Hibma <n_hibma@webweaving.org>
To: Daniel Hagan <dhagan@cs.vt.edu>
Cc: afo@zlug.org, freebsd-gnats-submit@freebsd.org
Subject: Re: kern/15983: C++ keyword in header file
Date: Tue, 18 Jan 2000 17:18:47 +0000 (GMT)

 The reason for the delay is simply that the class,subclass,etc. fields
 should go away completely. It's duplicate info that can be read from the
 device/configuration/interface descriptors.
 
 But it'll have to change (says dfr and he looked like he was sure
 about that :-) It'll break the utils that are based on it.
 
 Nick
 
 On Tue, 18 Jan 2000, Daniel Hagan wrote:
 
 > Why not wrap your application level include in an extern "C" construct?  
 > It seems like this would make more sense (as the kernel is written in C,
 > and you're the one importing it into a C++ context).  I don't see any
 > reason to make the kernel's C-coders responsible for C++ compatibility, do
 > you?
 > 
 > Daniel
 > 
 > -- 
 > Daniel Hagan                                             Computer Science CSE
 > dhagan@cs.vt.edu                                http://www.cs.vt.edu/~dhagan/
 > 
 > 
 
 --
 n_hibma@webweaving.org
 n_hibma@freebsd.org                                          USB project
 http://www.etla.net/~n_hibma/
 
 
State-Changed-From-To: open->closed 
State-Changed-By: jmg 
State-Changed-When: Fri Jun 20 17:21:32 PDT 2003 
State-Changed-Why:  
this has been fixed by prepending udi_ to the field. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=15983 
>Unformatted:
