Unterminated extern "C" bracketing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unterminated extern "C" bracketing

441 Views
johnstrohm
Contributor III

When declaring things in a header file that must be visible/linkable from both C and C++, the standard technique is:

#ifdef __cplusplus

extern "C" {

#endif

    /* declarations go here */

#ifdef __cplusplus

}

#endif

One occasionally sees an alternate form:

#if defined(__cplusplus)

extern "C" {

#endif

    /* declarations go here */

#if defined(__cplusplus)

}

#endif

In the USB 5.0 stack, files fsl_usb_ehci_hal.h and fsl_usb_khci_hal.h contain the first (opening) block but never the second (closing) block.  File fsl_usb_khci_hal.h contains it in two places.  If those header files are ever imported by a C++ module, the compiler will be very unhappy.

Admittedly, these two headers will probably not see C++ usage any time soon.

Labels (1)
Tags (2)
0 Kudos
1 Reply

307 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi John,

Thanks for your report! I have passed it to our USB stack team, and this would be fixed in the next release.

Best Regards,

Kan

0 Kudos