Skip to content

Commit a610550

Browse files
Merge pull request #4218 from facebook/externC
Move #includes out of `extern "C"` blocks
2 parents f5e2996 + 8f49db5 commit a610550

37 files changed

+157
-304
lines changed

contrib/pzstd/test/PzstdTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
* in the COPYING file in the root directory of this source tree).
88
*/
99
#include "Pzstd.h"
10-
extern "C" {
1110
#include "datagen.h"
12-
}
1311
#include "test/RoundTrip.h"
1412
#include "utils/ScopeGuard.h"
1513

contrib/pzstd/test/RoundTripTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
77
* in the COPYING file in the root directory of this source tree).
88
*/
9-
extern "C" {
109
#include "datagen.h"
11-
}
1210
#include "Options.h"
1311
#include "test/RoundTrip.h"
1412
#include "utils/ScopeGuard.h"

contrib/seekable_format/zstd_seekable.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#ifndef SEEKABLE_H
22
#define SEEKABLE_H
33

4+
#include <stdio.h>
5+
#include "zstd.h" /* ZSTDLIB_API */
6+
47
#if defined (__cplusplus)
58
extern "C" {
69
#endif
710

8-
#include <stdio.h>
9-
#include "zstd.h" /* ZSTDLIB_API */
10-
1111

1212
#define ZSTD_seekTableFooterSize 9
1313

lib/common/bitstream.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
#ifndef BITSTREAM_H_MODULE
1515
#define BITSTREAM_H_MODULE
1616

17-
#if defined (__cplusplus)
18-
extern "C" {
19-
#endif
2017
/*
2118
* This API consists of small unitary functions, which must be inlined for best performance.
2219
* Since link-time-optimization is not available for all compilers,
@@ -32,7 +29,6 @@ extern "C" {
3229
#include "error_private.h" /* error codes and messages */
3330
#include "bits.h" /* ZSTD_highbit32 */
3431

35-
3632
/*=========================================
3733
* Target specific
3834
=========================================*/
@@ -450,8 +446,4 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream)
450446
return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
451447
}
452448

453-
#if defined (__cplusplus)
454-
}
455-
#endif
456-
457449
#endif /* BITSTREAM_H_MODULE */

lib/common/debug.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
#ifndef DEBUG_H_12987983217
3333
#define DEBUG_H_12987983217
3434

35-
#if defined (__cplusplus)
36-
extern "C" {
37-
#endif
38-
3935

4036
/* static assert is triggered at compile time, leaving no runtime artefact.
4137
* static assert only works with compile-time constants.
@@ -108,9 +104,4 @@ extern int g_debuglevel; /* the variable is only declared,
108104
# define DEBUGLOG(l, ...) do { } while (0) /* disabled */
109105
#endif
110106

111-
112-
#if defined (__cplusplus)
113-
}
114-
#endif
115-
116107
#endif /* DEBUG_H_12987983217 */

lib/common/error_private.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
#ifndef ERROR_H_MODULE
1414
#define ERROR_H_MODULE
1515

16-
#if defined (__cplusplus)
17-
extern "C" {
18-
#endif
19-
20-
2116
/* ****************************************
2217
* Dependencies
2318
******************************************/
@@ -26,7 +21,6 @@ extern "C" {
2621
#include "debug.h"
2722
#include "zstd_deps.h" /* size_t */
2823

29-
3024
/* ****************************************
3125
* Compiler-specific
3226
******************************************/
@@ -161,8 +155,4 @@ void _force_has_format_string(const char *format, ...) {
161155
} \
162156
} while(0)
163157

164-
#if defined (__cplusplus)
165-
}
166-
#endif
167-
168158
#endif /* ERROR_H_MODULE */

lib/common/fse.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
* in the COPYING file in the root directory of this source tree).
1212
* You may select, at your option, one of the above-listed licenses.
1313
****************************************************************** */
14-
15-
#if defined (__cplusplus)
16-
extern "C" {
17-
#endif
18-
1914
#ifndef FSE_H
2015
#define FSE_H
2116

@@ -25,7 +20,6 @@ extern "C" {
2520
******************************************/
2621
#include "zstd_deps.h" /* size_t, ptrdiff_t */
2722

28-
2923
/*-*****************************************
3024
* FSE_PUBLIC_API : control library symbols visibility
3125
******************************************/
@@ -232,11 +226,8 @@ If there is an error, the function will return an error code, which can be teste
232226

233227
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
234228
#define FSE_H_FSE_STATIC_LINKING_ONLY
235-
236-
/* *** Dependency *** */
237229
#include "bitstream.h"
238230

239-
240231
/* *****************************************
241232
* Static allocation
242233
*******************************************/
@@ -631,10 +622,4 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
631622

632623
#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
633624

634-
635625
#endif /* FSE_STATIC_LINKING_ONLY */
636-
637-
638-
#if defined (__cplusplus)
639-
}
640-
#endif

lib/common/huf.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
* You may select, at your option, one of the above-listed licenses.
1313
****************************************************************** */
1414

15-
#if defined (__cplusplus)
16-
extern "C" {
17-
#endif
18-
1915
#ifndef HUF_H_298734234
2016
#define HUF_H_298734234
2117

@@ -25,7 +21,6 @@ extern "C" {
2521
#define FSE_STATIC_LINKING_ONLY
2622
#include "fse.h"
2723

28-
2924
/* *** Tool functions *** */
3025
#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
3126
size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
@@ -280,7 +275,3 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize
280275
#endif
281276

282277
#endif /* HUF_H_298734234 */
283-
284-
#if defined (__cplusplus)
285-
}
286-
#endif

lib/common/mem.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#ifndef MEM_H_MODULE
1212
#define MEM_H_MODULE
1313

14-
#if defined (__cplusplus)
15-
extern "C" {
16-
#endif
17-
1814
/*-****************************************
1915
* Dependencies
2016
******************************************/
@@ -76,7 +72,6 @@ extern "C" {
7672
typedef signed long long S64;
7773
#endif
7874

79-
8075
/*-**************************************************************
8176
* Memory I/O API
8277
*****************************************************************/
@@ -424,9 +419,4 @@ MEM_STATIC void MEM_writeBEST(void* memPtr, size_t val)
424419
/* code only tested on 32 and 64 bits systems */
425420
MEM_STATIC void MEM_check(void) { DEBUG_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); }
426421

427-
428-
#if defined (__cplusplus)
429-
}
430-
#endif
431-
432422
#endif /* MEM_H_MODULE */

lib/common/pool.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#ifndef POOL_H
1212
#define POOL_H
1313

14-
#if defined (__cplusplus)
15-
extern "C" {
16-
#endif
17-
1814

1915
#include "zstd_deps.h"
2016
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */
@@ -82,9 +78,4 @@ void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque);
8278
*/
8379
int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque);
8480

85-
86-
#if defined (__cplusplus)
87-
}
88-
#endif
89-
9081
#endif

0 commit comments

Comments
 (0)