diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-06-02 15:28:07 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-06-02 15:28:07 +0000 |
commit | 6d22a00e8b78a72b4b210b03dd1018a0e6f0bbc1 (patch) | |
tree | 60ed9a5a0be29d80ac92292d9b61c533e869aaa5 /LUFA | |
parent | 23a94a7181a0773431b3ea5dbcddab9e06010391 (diff) | |
download | lufa-6d22a00e8b78a72b4b210b03dd1018a0e6f0bbc1.tar.gz lufa-6d22a00e8b78a72b4b210b03dd1018a0e6f0bbc1.tar.bz2 lufa-6d22a00e8b78a72b4b210b03dd1018a0e6f0bbc1.zip |
Better fix to avoid void pointer arithmetic in ConfigDescriptor.h to regain C++ compatibility (thanks to Michael Hennebry).
Diffstat (limited to 'LUFA')
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h | 20 | ||||
-rw-r--r-- | LUFA/ManPages/ChangeLog.txt | 1 |
2 files changed, 5 insertions, 16 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h index 87610c7ba..5aa8f3cfa 100644 --- a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h +++ b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h @@ -257,16 +257,6 @@ uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, void** const CurrConfigLoc, ConfigComparatorPtr_t const ComparatorRoutine); /* Inline Functions: */ - #if !defined(__DOXYGEN__) - static inline void USB_GetNextDescriptorST(uint16_t* const BytesRem, uint8_t** CurrConfigLoc) - { - uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size; - - *CurrConfigLoc += CurrDescriptorSize; - *BytesRem -= CurrDescriptorSize; - } - #endif - /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then points to the next sub-descriptor. The bytes remaining value is automatically decremented. * @@ -277,12 +267,10 @@ ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, void** CurrConfigLoc) { - /* Horrible workaround for a bug in GCC - in some circumstances, the code generated for the strongly-typed - * (uint8_t**) cast to avoid void pointer arithmetic (which is not allowed in C++) causes incorrect code to - * be generated. Performing the cast and using a secondary inline routine show here seems to avoid the - * problem. - */ - USB_GetNextDescriptorST(BytesRem, (uint8_t**)CurrConfigLoc); + uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size; + + *CurrConfigLoc += ((uint8_t*)*CurrConfigLoc) + CurrDescriptorSize; + *BytesRem -= CurrDescriptorSize; } /* Disable C linkage for C++ Compilers: */ diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index c123116c7..03e55b962 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -31,6 +31,7 @@ * - Fixed XPLAINBridge project not correctly reading the XMEGA's supply voltage when reporting back to the host * - Fixed incorrect signature for the ATMEGA32U2 in the DFU bootloader (thanks to Axel Rohde) * - Fixed internal device serial not being accessible on the ATMEGAXXU2 AVRs (thanks to Axel Rohde) + * - Fixed void pointer arithmetic in ConfigDescriptor.h breaking C++ compatibility (thanks to Michael Hennebry) * * \section Sec_ChangeLog100513 Version 100513 * <b>New:</b> |