Skip to content

Commit 0ddcf49

Browse files
pabigotioannisg
authored andcommitted
soc/arm/silabs_exx32: clean up use of extern "C"
Remove extern "C" support from files that don't declare symbols subject to language linkage effects. Consistently place C++ use of extern "C" after all include directives, within the negative branch of _ASMLANGUAGE if used. 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 <[email protected]>
1 parent ce3f079 commit 0ddcf49

File tree

6 files changed

+8
-40
lines changed

6 files changed

+8
-40
lines changed

soc/arm/silabs_exx32/common/soc_gpio.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#include <soc.h>
1515
#include <em_gpio.h>
1616

17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
1721
struct soc_gpio_pin {
1822
GPIO_Port_TypeDef port; /** GPIO port */
1923
unsigned int pin; /** GPIO pin on the port */
@@ -27,4 +31,8 @@ struct soc_gpio_pin {
2731
*/
2832
void soc_gpio_configure(const struct soc_gpio_pin *pin);
2933

34+
#ifdef __cplusplus
35+
}
36+
#endif
37+
3038
#endif /* _SILABS_EXX32_SOC_GPIO_H_ */

soc/arm/silabs_exx32/efm32hg/soc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#include <sys/util.h>
1717

18-
#ifdef __cplusplus
19-
extern "C" {
20-
#endif
21-
2218
#ifndef _ASMLANGUAGE
2319

2420
#include <em_common.h>
@@ -29,8 +25,4 @@ extern "C" {
2925

3026
#endif /* !_ASMLANGUAGE */
3127

32-
#ifdef __cplusplus
33-
}
34-
#endif
35-
3628
#endif /* _SOC__H_ */

soc/arm/silabs_exx32/efm32pg12b/soc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#include <sys/util.h>
1717

18-
#ifdef __cplusplus
19-
extern "C" {
20-
#endif
21-
2218
#ifndef _ASMLANGUAGE
2319

2420
#include <em_bus.h>
@@ -30,8 +26,4 @@ extern "C" {
3026

3127
#endif /* !_ASMLANGUAGE */
3228

33-
#ifdef __cplusplus
34-
}
35-
#endif
36-
3729
#endif /* _SOC__H_ */

soc/arm/silabs_exx32/efm32wg/soc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#include <sys/util.h>
1717

18-
#ifdef __cplusplus
19-
extern "C" {
20-
#endif
21-
2218
#ifndef _ASMLANGUAGE
2319

2420
#include <em_bus.h>
@@ -30,8 +26,4 @@ extern "C" {
3026

3127
#endif /* !_ASMLANGUAGE */
3228

33-
#ifdef __cplusplus
34-
}
35-
#endif
36-
3729
#endif /* _SOC__H_ */

soc/arm/silabs_exx32/efr32fg1p/soc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#include <sys/util.h>
1717

18-
#ifdef __cplusplus
19-
extern "C" {
20-
#endif
21-
2218
#ifndef _ASMLANGUAGE
2319

2420
#include <em_bus.h>
@@ -30,8 +26,4 @@ extern "C" {
3026

3127
#endif /* !_ASMLANGUAGE */
3228

33-
#ifdef __cplusplus
34-
}
35-
#endif
36-
3729
#endif /* _SOC__H_ */

soc/arm/silabs_exx32/efr32mg12p/soc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
#include <sys/util.h>
1717

18-
#ifdef __cplusplus
19-
extern "C" {
20-
#endif
21-
2218
#ifndef _ASMLANGUAGE
2319

2420
#include <em_common.h>
@@ -29,8 +25,4 @@ extern "C" {
2925

3026
#endif /* !_ASMLANGUAGE */
3127

32-
#ifdef __cplusplus
33-
}
34-
#endif
35-
3628
#endif /* _SOC__H_ */

0 commit comments

Comments
 (0)