*: 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,8 @@
#ifndef SPA_COMMAND_NODE_H
#define SPA_COMMAND_NODE_H
#include <spa/pod/command.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -14,8 +16,6 @@ extern "C" {
* \{
*/
#include <spa/pod/command.h>
/* object id of SPA_TYPE_COMMAND_Node */
enum spa_node_command {
SPA_NODE_COMMAND_Suspend, /**< suspend a node, this removes all configured

View file

@ -5,6 +5,8 @@
#ifndef SPA_EVENT_NODE_H
#define SPA_EVENT_NODE_H
#include <spa/pod/event.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -14,8 +16,6 @@ extern "C" {
* \{
*/
#include <spa/pod/event.h>
/* object id of SPA_TYPE_EVENT_Node */
enum spa_node_event {
SPA_NODE_EVENT_Error,

View file

@ -5,6 +5,9 @@
#ifndef SPA_IO_H
#define SPA_IO_H
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -14,9 +17,6 @@ extern "C" {
* \{
*/
#include <spa/utils/defs.h>
#include <spa/pod/pod.h>
/** IO areas
*
* IO information for a port on a node. This is allocated

View file

@ -5,6 +5,14 @@
#ifndef SPA_NODE_H
#define SPA_NODE_H
#include <errno.h>
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#include <spa/utils/hook.h>
#include <spa/buffer/buffer.h>
#include <spa/node/event.h>
#include <spa/node/command.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -19,14 +27,6 @@ extern "C" {
* \{
*/
#include <errno.h>
#include <spa/utils/defs.h>
#include <spa/utils/type.h>
#include <spa/utils/hook.h>
#include <spa/buffer/buffer.h>
#include <spa/node/event.h>
#include <spa/node/command.h>
#ifndef SPA_API_NODE
#ifdef SPA_API_IMPL
#define SPA_API_NODE SPA_API_IMPL

View file

@ -5,6 +5,12 @@
#ifndef SPA_NODE_TYPES_H
#define SPA_NODE_TYPES_H
#include <spa/utils/type.h>
#include <spa/node/command.h>
#include <spa/node/event.h>
#include <spa/node/io.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -14,12 +20,6 @@ extern "C" {
* \{
*/
#include <spa/utils/type.h>
#include <spa/node/command.h>
#include <spa/node/event.h>
#include <spa/node/io.h>
#define SPA_TYPE_INFO_IO SPA_TYPE_INFO_ENUM_BASE "IO"
#define SPA_TYPE_INFO_IO_BASE SPA_TYPE_INFO_IO ":"

View file

@ -5,6 +5,10 @@
#ifndef SPA_NODE_UTILS_H
#define SPA_NODE_UTILS_H
#include <spa/pod/builder.h>
#include <spa/node/node.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -14,10 +18,6 @@ extern "C" {
* \{
*/
#include <spa/pod/builder.h>
#include <spa/node/node.h>
#ifndef SPA_API_NODE_UTILS
#ifdef SPA_API_IMPL
#define SPA_API_NODE_UTILS SPA_API_IMPL