From b0dffdc2ca9a6d177dcf5114f32a96d934cc92b4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 5 Nov 2016 07:25:05 -0600 Subject: [PATCH] Fix a number of header files with mismatched 'extern C {' and '}' --- arch/arm/src/kl/kl_spi.h | 5 +++++ arch/arm/src/lpc43xx/chip/lpc43_ethernet.h | 10 ---------- arch/arm/src/lpc43xx/lpc43_ethernet.h | 3 ++- arch/mips/src/pic32mz/pic32mz-dma.h | 5 +++++ arch/risc-v/src/common/up_internal.h | 16 ++++++++++------ arch/xtensa/src/esp32/esp32_gpio.h | 9 ++------- configs/fire-stm32v2/include/board.h | 8 +++++++- drivers/usbhost/usbhost_composite.h | 9 +++++++++ fs/aio/aio.h | 5 +++++ include/nuttx/arch.h | 3 +-- include/nuttx/binfmt/symtab.h | 5 +++++ libc/aio/aio.h | 5 +++++ net/loopback/loopback.h | 5 +++++ 13 files changed, 61 insertions(+), 27 deletions(-) diff --git a/arch/arm/src/kl/kl_spi.h b/arch/arm/src/kl/kl_spi.h index 466ab832f8..227ab9e6c5 100644 --- a/arch/arm/src/kl/kl_spi.h +++ b/arch/arm/src/kl/kl_spi.h @@ -126,6 +126,11 @@ int kl_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); #endif #endif +#if defined(__cplusplus) +} +#endif +#undef EXTERN + #endif /* __ASSEMBLY__ */ #endif /* CONFIG_KL_SPI0 || CONFIG_KL_SPI1 */ #endif /* __ARCH_ARM_SRC_KL_KL_SPI_H */ diff --git a/arch/arm/src/lpc43xx/chip/lpc43_ethernet.h b/arch/arm/src/lpc43xx/chip/lpc43_ethernet.h index 6da125a6fe..d03ed7123b 100644 --- a/arch/arm/src/lpc43xx/chip/lpc43_ethernet.h +++ b/arch/arm/src/lpc43xx/chip/lpc43_ethernet.h @@ -653,15 +653,5 @@ struct eth_rxdesc_s * Public Functions ****************************************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - #endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM_SRC_LPC43XX_CHIP_LPC43_ETHERNET_H */ - diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.h b/arch/arm/src/lpc43xx/lpc43_ethernet.h index 55888fc727..7d60a43697 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.h +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.h @@ -55,7 +55,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif diff --git a/arch/mips/src/pic32mz/pic32mz-dma.h b/arch/mips/src/pic32mz/pic32mz-dma.h index 99cc6c47c5..3bea2172ee 100644 --- a/arch/mips/src/pic32mz/pic32mz-dma.h +++ b/arch/mips/src/pic32mz/pic32mz-dma.h @@ -224,5 +224,10 @@ void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs, #endif #endif +#if defined(__cplusplus) +} +#endif +#undef EXTERN + #endif /* __ASSEMBLY__ */ #endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_DMA_H */ diff --git a/arch/risc-v/src/common/up_internal.h b/arch/risc-v/src/common/up_internal.h index f4481a2269..f18d937150 100644 --- a/arch/risc-v/src/common/up_internal.h +++ b/arch/risc-v/src/common/up_internal.h @@ -104,13 +104,17 @@ * Public Variables ****************************************************************************/ -extern volatile uint32_t *g_current_regs; +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif -extern uint32_t g_idle_topstack; - -/**************************************************************************** - * Inline Functions - ****************************************************************************/ +EXTERN volatile uint32_t *g_current_regs; +EXTERN uint32_t g_idle_topstack; /**************************************************************************** * Public Functions diff --git a/arch/xtensa/src/esp32/esp32_gpio.h b/arch/xtensa/src/esp32/esp32_gpio.h index ea09df2439..e4b647b976 100644 --- a/arch/xtensa/src/esp32/esp32_gpio.h +++ b/arch/xtensa/src/esp32/esp32_gpio.h @@ -199,13 +199,6 @@ void esp32_gpioirqdisable(int irq); # define esp32_gpioirqdisable(irq) #endif -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ - int digitalRead(uint8_t pin); void attachInterrupt(uint8_t pin, void (*)(void), int mode); @@ -214,5 +207,7 @@ void detachInterrupt(uint8_t pin); #ifdef __cplusplus } #endif +#undef EXTERN +#endif /* __ASSEMBLY__ */ #endif /* __ARCH_XTENSA_SRC_ESP32_ESP32_GPIO_H */ diff --git a/configs/fire-stm32v2/include/board.h b/configs/fire-stm32v2/include/board.h index 0f9e7c11aa..4319e397a9 100644 --- a/configs/fire-stm32v2/include/board.h +++ b/configs/fire-stm32v2/include/board.h @@ -371,7 +371,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -406,5 +407,10 @@ void stm32_boardinitialize(void); void fire_lcdclear(uint16_t color); #endif +#if defined(__cplusplus) +} +#endif +#undef EXTERN + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_FIRE_STM32V2_INCLUDE_BOARD_H */ diff --git a/drivers/usbhost/usbhost_composite.h b/drivers/usbhost/usbhost_composite.h index 4d1e35d0d1..765624da2a 100644 --- a/drivers/usbhost/usbhost_composite.h +++ b/drivers/usbhost/usbhost_composite.h @@ -51,6 +51,15 @@ * Public Function Prototypes ****************************************************************************/ +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + /**************************************************************************** * Name: usbhost_composite * diff --git a/fs/aio/aio.h b/fs/aio/aio.h index f74269a19a..73ff7faa79 100644 --- a/fs/aio/aio.h +++ b/fs/aio/aio.h @@ -277,5 +277,10 @@ int aio_queue(FAR struct aio_container_s *aioc, worker_t worker); int aio_signal(pid_t pid, FAR struct aiocb *aiocbp); +#undef EXTERN +#if defined(__cplusplus) +} +#endif + #endif /* CONFIG_FS_AIO */ #endif /* __FS_AIO_AIO_H */ diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 1ef8efe4b1..8b83308fc8 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -2294,9 +2294,8 @@ void arch_sporadic_resume(FAR struct tcb_s *tcb); #endif #undef EXTERN -#ifdef __cplusplus +#if defined(__cplusplus) } #endif #endif /* __INCLUDE_NUTTX_ARCH_H */ - diff --git a/include/nuttx/binfmt/symtab.h b/include/nuttx/binfmt/symtab.h index 9e51ca3539..affb7cda17 100644 --- a/include/nuttx/binfmt/symtab.h +++ b/include/nuttx/binfmt/symtab.h @@ -90,4 +90,9 @@ void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); +#undef EXTERN +#if defined(__cplusplus) +} +#endif + #endif /* __INCLUDE_NUTTX_BINFMT_SYMTAB_H */ diff --git a/libc/aio/aio.h b/libc/aio/aio.h index f28340f3c2..f61e6908f5 100644 --- a/libc/aio/aio.h +++ b/libc/aio/aio.h @@ -69,5 +69,10 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +#undef EXTERN +#if defined(__cplusplus) +} +#endif + #endif /* CONFIG_FS_AIO */ #endif /* __LIBC_AIO_AIO_H */ diff --git a/net/loopback/loopback.h b/net/loopback/loopback.h index 8529fdbd1c..a881f46fdb 100644 --- a/net/loopback/loopback.h +++ b/net/loopback/loopback.h @@ -68,5 +68,10 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +#undef EXTERN +#ifdef __cplusplus +} +#endif + #endif /* CONFIG_NET_LOOPBACK */ #endif /* __NET_LOOPBACK_LOOBACK_H */