Ticket #64 (closed defect: fixed)

Opened 3 years ago

Last modified 18 months ago

libusb invalidly uses reserved identifiers when naming variables, structs, etc.

Reported by: rogueresearch Owned by: segher
Milestone: Component: libusb-1.0
Keywords: Cc:
Blocked By: Blocks:

Description

The ISO/IEC 9899:1999 standard in Section 7.1.3, "Reserved Identifiers" describes how several naming schemes are reserved, notably "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use."

libusb violates this in several places, ex:

  • include guards like #define LIBUSB_THREADS_POSIX_H
  • struct name: darwin_interface
  • etc. etc.

See also:

http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier

https://www.securecoding.cert.org/confluence/display/seccode/DCL37-C.+Do+not+use+identifiers+that+are+reserved+for+the+implementation

Attachments

underscore_fix.patch (65.0 KB) - added by hjelmn 2 years ago.
First pass at making libusb compliant with C99 section 7.1.3

Download all attachments as: .zip

Change History

comment:1 Changed 3 years ago by segher

  • Owner set to segher
  • Status changed from new to accepted

ACK. Got patches? It's best not to do one mega-patch.

comment:2 follow-up: Changed 3 years ago by rogueresearch

No, I have no patch.

To be frank, I'm not willing (currently) to invest the time in creating such a patch, because patches do not seem to get accepted (as per recent mailing list discussions).

comment:3 in reply to: ↑ 2 Changed 3 years ago by segher

No, I have no patch.

To be frank, I'm not willing (currently) to invest the time in creating such a patch,

That's understandable. This isn't very high priority anyway; it
doesn't have a high probability of causing problems in practice.

because patches do not seem to get accepted (as per recent mailing list discussions).

Don't believe the naysayers. The only way to *ensure* nothing
happens is to not send patches! ;-)

comment:4 follow-up: Changed 3 years ago by rogueresearch

My tiny patches in 63 and 28 have not been accepted; when and if they are, then maybe I'll invest time in this, until then, I'm with the naysayers I'm afraid.

comment:5 in reply to: ↑ 4 Changed 2 years ago by stuge

Replying to rogueresearch:

My tiny patches in 63 and 28 have not been accepted; when and if they are, then maybe I'll invest time in this, until then, I'm with the naysayers I'm afraid.

I'm sorry that you feel that your patches have been ignored because of the lack of feedback. I can understand it. Let me assure you that your work is very much appreciated, and thanks to it being stored in tickets it can not, and will not, be overlooked.

Changed 2 years ago by hjelmn

First pass at making libusb compliant with C99 section 7.1.3

comment:6 Changed 2 years ago by hjelmn

The attached patch (against libusb-stuge) is a first attempt at fixing this bug. Please review.

comment:7 Changed 18 months ago by Nathan Hjelm <hjelmn@…>

  • Resolution set to fixed
  • Status changed from accepted to closed

In [d1bd234f7e1b1ff4168b8f605e2038e87a0e361f/libusb]:

Fix #64 use of reserved identifiers throughout libusb

Note: See TracTickets for help on using tickets.