Move #includes out of extern "C" blocks

Do some include shuffling for `**.h` files within lib, programs, tests, and zlibWrapper.
`lib/legacy` and `lib/deprecated` are untouched.
`#include`s within `extern "C"` blocks in .cpp files are untouched.

todo: shuffling for `xxhash.h`
This commit is contained in:
Victor Zhang
2024-12-17 17:55:07 -08:00
parent 0218c8de0f
commit fc726da774
27 changed files with 135 additions and 121 deletions
+4 -4
View File
@@ -15,10 +15,6 @@
* or detecting and returning an error
*/
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef BENCH_FN_H_23876
#define BENCH_FN_H_23876
@@ -26,6 +22,10 @@ extern "C" {
#include <stddef.h> /* size_t */
#if defined (__cplusplus)
extern "C" {
#endif
/* ==== Benchmark any function, iterated on a set of blocks ==== */
/* BMK_runTime_t: valid result return type */
+4 -4
View File
@@ -14,10 +14,6 @@
* and display progress result and final summary
*/
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef BENCH_ZSTD_H_3242387
#define BENCH_ZSTD_H_3242387
@@ -27,6 +23,10 @@ extern "C" {
#include "../lib/zstd.h" /* ZSTD_compressionParameters */
#if defined (__cplusplus)
extern "C" {
#endif
/* === Constants === */
#define MB_UNIT 1000000
+4 -4
View File
@@ -22,10 +22,6 @@
#ifndef ZSTD_FILEIO_ASYNCIO_H
#define ZSTD_FILEIO_ASYNCIO_H
#if defined (__cplusplus)
extern "C" {
#endif
#include "../lib/common/mem.h" /* U32, U64 */
#include "fileio_types.h"
#include "platform.h"
@@ -35,6 +31,10 @@ extern "C" {
#define MAX_IO_JOBS (10)
#if defined (__cplusplus)
extern "C" {
#endif
typedef struct {
/* These struct fields should be set only on creation and not changed afterwards */
POOL_ctx* threadPool;
+11 -5
View File
@@ -11,15 +11,22 @@
#ifndef ZSTD_FILEIO_COMMON_H
#define ZSTD_FILEIO_COMMON_H
#if defined (__cplusplus)
extern "C" {
#endif
#include "../lib/common/mem.h" /* U32, U64 */
#include "fileio_types.h"
#include "platform.h"
#include "timefn.h" /* UTIL_getTime, UTIL_clockSpanMicro */
#if !(defined(_MSC_VER) && _MSC_VER >= 1400) \
&& !(!defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L)) \
&& !(defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__)) \
&& (defined(_WIN32) && !defined(__DJGPP__))
# include <windows.h>
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/*-*************************************
* Macros
***************************************/
@@ -89,7 +96,6 @@ extern UTIL_time_t g_displayClock;
# define LONG_SEEK fseeko64
# define LONG_TELL ftello64
#elif defined(_WIN32) && !defined(__DJGPP__)
# include <windows.h>
static int LONG_SEEK(FILE* file, __int64 offset, int origin) {
LARGE_INTEGER off;
DWORD method;
+10 -11
View File
@@ -11,12 +11,6 @@
#ifndef PLATFORM_H_MODULE
#define PLATFORM_H_MODULE
#if defined (__cplusplus)
extern "C" {
#endif
/* **************************************
* Compiler Options
****************************************/
@@ -144,10 +138,20 @@ extern "C" {
# include <io.h> /* _isatty */
# include <windows.h> /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */
# include <stdio.h> /* FILE */
#if defined (__cplusplus)
extern "C" {
#endif
static __inline int IS_CONSOLE(FILE* stdStream) {
DWORD dummy;
return _isatty(_fileno(stdStream)) && GetConsoleMode((HANDLE)_get_osfhandle(_fileno(stdStream)), &dummy);
}
#if defined (__cplusplus)
}
#endif
#else
# define IS_CONSOLE(stdStream) 0
#endif
@@ -210,9 +214,4 @@ static __inline int IS_CONSOLE(FILE* stdStream) {
# endif
#endif
#if defined (__cplusplus)
}
#endif
#endif /* PLATFORM_H_MODULE */
+5 -6
View File
@@ -11,12 +11,6 @@
#ifndef TIME_FN_H_MODULE_287987
#define TIME_FN_H_MODULE_287987
#if defined (__cplusplus)
extern "C" {
#endif
/*-****************************************
* Types
******************************************/
@@ -32,6 +26,11 @@ extern "C" {
typedef unsigned long long PTime; /* does not support compilers without long long support */
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/* UTIL_time_t contains a nanosecond time counter.
* The absolute value is not meaningful.
* It's only valid to compute the difference between 2 measurements. */
-9
View File
@@ -8,11 +8,6 @@
* You may select, at your option, one of the above-listed licenses.
*/
#if defined (__cplusplus)
extern "C" {
#endif
/*-****************************************
* Dependencies
******************************************/
@@ -1646,7 +1641,3 @@ int UTIL_countLogicalCores(void)
{
return UTIL_countCores(1);
}
#if defined (__cplusplus)
}
#endif
+3 -1
View File
@@ -20,6 +20,9 @@
#include <sys/types.h> /* stat, utime */
#include <sys/stat.h> /* stat, chmod */
#include "../lib/common/mem.h" /* U64 */
#if not (defined(_MSC_VER) || defined(__MINGW32__) || defined (__MSVCRT__))
#include <libgen.h>
#endif
/*-************************************************************
* Fix fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
@@ -116,7 +119,6 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, const
#define STRDUP(s) _strdup(s)
#else
#define PATH_SEP '/'
#include <libgen.h>
#define STRDUP(s) strdup(s)
#endif