Browse Source

Don't include headers within `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.

See https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2377 in
PipeWire where they bundle some JACK headers, so came across this.
pull/1003/head
Sam James 4 months ago
parent
commit
e8633ad0d7
No known key found for this signature in database GPG Key ID: 738409F520DF9190
12 changed files with 41 additions and 49 deletions
  1. +4
    -5
      common/driver_interface.h
  2. +2
    -2
      common/jack/intclient.h
  3. +5
    -6
      common/jack/jack.h
  4. +3
    -4
      common/jack/midiport.h
  5. +4
    -5
      common/jack/net.h
  6. +3
    -4
      common/jack/ringbuffer.h
  7. +3
    -3
      common/jack/session.h
  8. +3
    -4
      common/jack/statistics.h
  9. +3
    -3
      common/jack/thread.h
  10. +3
    -3
      common/jack/transport.h
  11. +4
    -5
      common/netjack_packet.h
  12. +4
    -5
      tests/external_metro.h

+ 4
- 5
common/driver_interface.h View File

@@ -21,17 +21,16 @@
#ifndef __jack_driver_interface_h__
#define __jack_driver_interface_h__

#ifdef __cplusplus
extern "C"
{
#endif

#include <limits.h>
#include "jslist.h"

#include "JackCompilerDeps.h"
#include "JackSystemDeps.h"

#ifdef __cplusplus
extern "C" {
#endif

#define JACK_DRIVER_NAME_MAX 15
#define JACK_DRIVER_PARAM_NAME_MAX 15
#define JACK_DRIVER_PARAM_STRING_MAX 127


+ 2
- 2
common/jack/intclient.h View File

@@ -20,13 +20,13 @@
#ifndef __jack_intclient_h__
#define __jack_intclient_h__

#include <jack/types.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include <jack/types.h>

/**
* Get an internal client's name. This is useful when @ref
* JackUseExactName was not specified on jack_internal_client_load()


+ 5
- 6
common/jack/jack.h View File

@@ -21,15 +21,16 @@
#ifndef __jack_h__
#define __jack_h__

#include <jack/systemdeps.h>
#include <jack/types.h>
#include <jack/transport.h>
#include <jack/weakmacros.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include <jack/systemdeps.h>
#include <jack/types.h>
#include <jack/transport.h>

/**
* Note: More documentation can be found in jack/types.h.
*/
@@ -46,8 +47,6 @@ extern "C"
* <jack/weakjack.h> before jack.h.
*************************************************************/

#include <jack/weakmacros.h>

/**
* Call this function to get version of the JACK, in form of several numbers
*


+ 3
- 4
common/jack/midiport.h View File

@@ -21,14 +21,13 @@
#ifndef __JACK_MIDIPORT_H
#define __JACK_MIDIPORT_H

#ifdef __cplusplus
extern "C" {
#endif

#include <jack/weakmacros.h>
#include <jack/types.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/** Type for raw event data contained in @ref jack_midi_event_t. */
typedef unsigned char jack_midi_data_t;


+ 4
- 5
common/jack/net.h View File

@@ -20,15 +20,14 @@
#ifndef __net_h__
#define __net_h__

#ifdef __cplusplus
extern "C"
{
#endif

#include <jack/systemdeps.h>
#include <jack/types.h>
#include <jack/weakmacros.h>

#ifdef __cplusplus
extern "C" {
#endif

#define DEFAULT_MULTICAST_IP "225.3.19.154"
#define DEFAULT_PORT 19000
#define DEFAULT_MTU 1500


+ 3
- 4
common/jack/ringbuffer.h View File

@@ -21,13 +21,12 @@
#ifndef _RINGBUFFER_H
#define _RINGBUFFER_H

#include <sys/types.h>

#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif

#include <sys/types.h>

/** @file ringbuffer.h
*
* A set of library functions to make lock-free ringbuffers available


+ 3
- 3
common/jack/session.h View File

@@ -21,13 +21,13 @@
#ifndef __jack_session_h__
#define __jack_session_h__

#include <jack/types.h>
#include <jack/weakmacros.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <jack/types.h>
#include <jack/weakmacros.h>

/**
* @defgroup SessionClientFunctions Session API for clients.
*


+ 3
- 4
common/jack/statistics.h View File

@@ -21,13 +21,12 @@
#ifndef __statistics_h__
#define __statistics_h__

#include <jack/types.h>

#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif

#include <jack/types.h>

/**
* @return the maximum delay reported by the backend since
* startup or reset. When compared to the period size in usecs, this


+ 3
- 3
common/jack/thread.h View File

@@ -20,14 +20,14 @@
#ifndef __jack_thread_h__
#define __jack_thread_h__

#include <jack/systemdeps.h>
#include <jack/weakmacros.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include <jack/systemdeps.h>
#include <jack/weakmacros.h>

/* use 512KB stack per thread - the default is way too high to be feasible
* with mlockall() on many systems */
#define THREAD_STACK 524288


+ 3
- 3
common/jack/transport.h View File

@@ -21,13 +21,13 @@
#ifndef __jack_transport_h__
#define __jack_transport_h__

#include <jack/types.h>
#include <jack/weakmacros.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <jack/types.h>
#include <jack/weakmacros.h>

/**
* @defgroup TransportControl Transport and Timebase control
* @{


+ 4
- 5
common/netjack_packet.h View File

@@ -27,16 +27,15 @@
#ifndef __JACK_NET_PACKET_H__
#define __JACK_NET_PACKET_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include <jack/jack.h>
#include <jack/types.h>
#include <jack/jslist.h>
#include <jack/midiport.h>

#ifdef __cplusplus
extern "C" {
#endif

// The Packet Header.

#define CELT_MODE 1000 // Magic bitdepth value that indicates CELT compression


+ 4
- 5
tests/external_metro.h View File

@@ -21,11 +21,6 @@
#ifndef __external_metro__
#define __external_metro__

#ifdef __cplusplus
extern "C"
{
#endif

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
@@ -36,6 +31,10 @@ extern "C"
#include <jack/jack.h>
#include <jack/transport.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef jack_default_audio_sample_t sample_t;

/*!


Loading…
Cancel
Save