fixup __forceinline for cpp code and add kitchen_sink cpp test (#670)

* fix __force_inline for different GCC versions in cpp mode (the affected versions are different from c mode), and build kitchsink.c as a cpp file too for testing
* silly bug in host platform.h
This commit is contained in:
Graham Sanderson
2021-12-08 12:05:49 -06:00
committed by GitHub
parent 269332dc21
commit 0562089fab
36 changed files with 55 additions and 49 deletions

View File

@ -53,7 +53,7 @@ typedef struct spi_inst spi_inst_t;
*
* \ingroup hardware_spi
*/
#define spi0 ((spi_inst_t * const)spi0_hw)
#define spi0 ((spi_inst_t *)spi0_hw)
/** Identifier for the second (SPI 1) hardware SPI instance (for use in SPI functions).
*
@ -61,7 +61,7 @@ typedef struct spi_inst spi_inst_t;
*
* \ingroup hardware_spi
*/
#define spi1 ((spi_inst_t * const)spi1_hw)
#define spi1 ((spi_inst_t *)spi1_hw)
#if !defined(PICO_DEFAULT_SPI_INSTANCE) && defined(PICO_DEFAULT_SPI)
#define PICO_DEFAULT_SPI_INSTANCE (__CONCAT(spi,PICO_DEFAULT_SPI))

View File

@ -78,8 +78,8 @@ typedef struct uart_inst uart_inst_t;
* \ingroup hardware_uart
* @{
*/
#define uart0 ((uart_inst_t * const)uart0_hw) ///< Identifier for UART instance 0
#define uart1 ((uart_inst_t * const)uart1_hw) ///< Identifier for UART instance 1
#define uart0 ((uart_inst_t *)uart0_hw) ///< Identifier for UART instance 0
#define uart1 ((uart_inst_t *)uart1_hw) ///< Identifier for UART instance 1
/** @} */

View File

@ -233,7 +233,7 @@ extern "C" {
* int __force_inline my_function(int x) {
*
*/
#if defined(__GNUC__) && __GNUC__ <= 7
#if defined(__GNUC__) && (__GNUC__ <= 6 || (__GNUC__ == 7 && (__GNUC_MINOR__ < 3 || !defined(__cplusplus))))
#define __force_inline inline __always_inline
#else
#define __force_inline __always_inline