soc/arm/nxp*: rearrange for standard use of extern "C"

Consistently place C++ use of extern "C" after all include directives,
within the negative branch of _ASMLANGUAGE if used.

Remove extern "C" support from files that don't declare objects or
functions.

Background from issue #17997:

Declarations that use C linkage should be placed within extern "C"
so the language linkage is correct when the header is included by
a C++ compiler.

Similarly #include directives should be outside the extern "C" to
ensure the language-specific default linkage is applied to any
declarations provided by the included header.

See: https://en.cppreference.com/w/cpp/language/language_linkage
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-08-12 12:55:33 -05:00 committed by Ioannis Glaropoulos
commit ddf9b144ce
8 changed files with 6 additions and 62 deletions

View file

@ -7,10 +7,6 @@
#ifndef _SOC__H_
#define _SOC__H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include "rdc.h"
@ -20,8 +16,4 @@ extern "C" {
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -7,10 +7,6 @@
#ifndef _SOC__H_
#define _SOC__H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include "rdc.h"
@ -21,8 +17,4 @@ extern "C" {
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -9,10 +9,6 @@
#include <sys/util.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include <fsl_common.h>
@ -23,6 +19,10 @@ extern "C" {
*/
#include <kernel_includes.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(CONFIG_DISK_ACCESS_USDHC1) || \
defined(CONFIG_DISK_ACCESS_USDHC2)
@ -36,10 +36,10 @@ void imxrt_usdhc_pinmux_cb_register(usdhc_pin_cfg_cb cb);
#endif
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _SOC__H_ */

View file

@ -17,10 +17,6 @@
#include <sys/util.h>
#ifdef __cplusplus
extern "C" {
#endif
/* default system clock */
#define SYSCLK_DEFAULT_IOSC_HZ MHZ(120)
@ -40,8 +36,4 @@ extern "C" {
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -9,10 +9,6 @@
#include <sys/util.h>
#ifdef __cplusplus
extern "C" {
#endif
#define UART0_CLK_SRC kCLOCK_CoreSysClk
#ifndef _ASMLANGUAGE
@ -24,8 +20,4 @@ extern "C" {
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -10,10 +10,6 @@
#include <sys/util.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(CONFIG_SOC_MKW40Z4) || defined(CONFIG_SOC_MKW41Z4)
#define LPUART0_CLK_SRC kCLOCK_CoreSysClk
@ -35,8 +31,4 @@ extern "C" {
#endif /* !_ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -15,10 +15,6 @@
#ifndef _SOC__H_
#define _SOC__H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include <device.h>
#include <sys/util.h>
@ -36,8 +32,4 @@ extern "C" {
#define IOCON_PIO_SLEW_STANDARD 0x00u
#define IOCON_PIO_MODE_PULLUP 0x10u
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */

View file

@ -15,10 +15,6 @@
#ifndef _SOC__H_
#define _SOC__H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include <device.h>
#include <sys/util.h>
@ -37,8 +33,4 @@ extern "C" {
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
#define IOCON_PIO_INPFILT_OFF 0x1000u /*!<@brief Input filter disabled */
#ifdef __cplusplus
}
#endif
#endif /* _SOC__H_ */