Bug 210509 - libusb.h cannot be included in C++ after r302080
Summary: libusb.h cannot be included in C++ after r302080
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-24 06:06 UTC by Jung-uk Kim
Modified: 2016-06-24 10:56 UTC (History)
0 users

See Also:


Attachments
Fix (1.62 KB, patch)
2016-06-24 09:01 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jung-uk Kim freebsd_committer freebsd_triage 2016-06-24 06:06:27 UTC
Some ports failed to build after r302080, e.g., x11/kde4-workspace.

% cat test.cpp
#include <libusb.h>

int	dummy(void);

int
dummy(void)
{

	return (0);
}
% c++ -c test.cpp
In file included from test.cpp:1:
/usr/include/libusb.h:279:48: error: typedef redefinition with different types
      ('struct libusb_hotplug_callback_handle *' vs
      'libusb_hotplug_callback_handle')
typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle;
                                               ^
/usr/include/libusb.h:257:8: note: previous definition is here
struct libusb_hotplug_callback_handle;
       ^
1 error generated.
% g++48 -c test.cpp
In file included from test.cpp:1:0:
/usr/include/libusb.h:279:48: error: conflicting declaration 'typedef struct libusb_hotplug_callback_handle* libusb_hotplug_callback_handle'
 typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle;
                                                ^
/usr/include/libusb.h:257:8: error: 'struct libusb_hotplug_callback_handle' has a previous declaration as 'struct libusb_hotplug_callback_handle'
 struct libusb_hotplug_callback_handle;
        ^
Comment 1 Jung-uk Kim freebsd_committer freebsd_triage 2016-06-24 06:12:48 UTC
hselasky, please take a look.  Thanks!
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2016-06-24 08:58:50 UTC
I have a fix pending for review. Thank you!
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2016-06-24 09:01:15 UTC
Created attachment 171738 [details]
Fix
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-06-24 10:55:27 UTC
A commit references this bug:

Author: hselasky
Date: Fri Jun 24 10:55:15 UTC 2016
New revision: 302171
URL: https://svnweb.freebsd.org/changeset/base/302171

Log:
  Resolve issue with libusb C++ header file inclusion.

  Approved by:	re (marius)
  PR:		210509
  MFC after:	1 week

Changes:
  head/lib/libusb/libusb.h
  head/lib/libusb/libusb10.h