*: don't include standard C headers inside of extern "C"

Including C headers inside of `extern "C"` breaks use from C++. Hoist
the includes of standard C headers above the block so we don't try
to mangle the stdlib.

I initially tried to scope this with a targeted change but it's too
hard to do correctly that way. This way, we avoid whack-a-mole.

Firefox is working around this in their e21461b7b8b39cc31ba53c47d4f6f310c673ff2f
commit.

Bug: https://bugzilla.mozilla.org/1953080
This commit is contained in:
Sam James 2025-05-27 09:06:08 +01:00
parent e2731914ad
commit b943c31fd8
No known key found for this signature in database
GPG key ID: 738409F520DF9190
207 changed files with 753 additions and 752 deletions

View file

@ -5,6 +5,12 @@
#ifndef SPA_POD_BUILDER_H
#define SPA_POD_BUILDER_H
#include <stdarg.h>
#include <spa/utils/hook.h>
#include <spa/pod/iter.h>
#include <spa/pod/vararg.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -18,12 +24,6 @@ extern "C" {
* \{
*/
#include <stdarg.h>
#include <spa/utils/hook.h>
#include <spa/pod/iter.h>
#include <spa/pod/vararg.h>
#ifndef SPA_API_POD_BUILDER
#ifdef SPA_API_IMPL
#define SPA_API_POD_BUILDER SPA_API_IMPL

View file

@ -5,13 +5,13 @@
#ifndef SPA_COMMAND_H
#define SPA_COMMAND_H
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
/**
* \addtogroup spa_pod
* \{

View file

@ -5,10 +5,6 @@
#ifndef SPA_POD_COMPARE_H
#define SPA_POD_COMPARE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <errno.h>
#include <stdint.h>
@ -20,6 +16,10 @@ extern "C" {
#include <spa/pod/iter.h>
#include <spa/pod/builder.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SPA_API_POD_COMPARE
#ifdef SPA_API_IMPL
#define SPA_API_POD_COMPARE SPA_API_IMPL

View file

@ -5,13 +5,13 @@
#ifndef SPA_POD_DYNAMIC_H
#define SPA_POD_DYNAMIC_H
#include <spa/pod/builder.h>
#include <spa/utils/cleanup.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/pod/builder.h>
#include <spa/utils/cleanup.h>
#ifndef SPA_API_POD_DYNAMIC
#ifdef SPA_API_IMPL
#define SPA_API_POD_DYNAMIC SPA_API_IMPL

View file

@ -5,12 +5,12 @@
#ifndef SPA_EVENT_H
#define SPA_EVENT_H
#include <spa/pod/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/pod/pod.h>
/**
* \addtogroup spa_pod
* \{

View file

@ -5,10 +5,6 @@
#ifndef SPA_POD_FILTER_H
#define SPA_POD_FILTER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h>
#include <stdint.h>
#include <stddef.h>
@ -21,6 +17,10 @@ extern "C" {
#include <spa/pod/compare.h>
#include <spa/pod/dynamic.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SPA_API_POD_FILTER
#ifdef SPA_API_IMPL
#define SPA_API_POD_FILTER SPA_API_IMPL

View file

@ -5,15 +5,15 @@
#ifndef SPA_POD_ITER_H
#define SPA_POD_ITER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h>
#include <sys/types.h>
#include <spa/pod/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SPA_API_POD_ITER
#ifdef SPA_API_IMPL
#define SPA_API_POD_ITER SPA_API_IMPL

View file

@ -5,16 +5,16 @@
#ifndef SPA_POD_PARSER_H
#define SPA_POD_PARSER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h>
#include <stdarg.h>
#include <spa/pod/iter.h>
#include <spa/pod/vararg.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SPA_API_POD_PARSER
#ifdef SPA_API_IMPL
#define SPA_API_POD_PARSER SPA_API_IMPL

View file

@ -5,13 +5,13 @@
#ifndef SPA_POD_H
#define SPA_POD_H
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
/**
* \addtogroup spa_pod
* \{

View file

@ -5,14 +5,14 @@
#ifndef SPA_POD_VARARG_H
#define SPA_POD_VARARG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <spa/pod/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \addtogroup spa_pod
* \{