Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-110079: Remove extern "C" { ...} in C code #110080

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Modules/_scproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,8 @@ static struct PyModuleDef _scproxy_module = {
.m_slots = _scproxy_slots,
};

#ifdef __cplusplus
extern "C" {
#endif

PyMODINIT_FUNC
PyInit__scproxy(void)
{
return PyModuleDef_Init(&_scproxy_module);
}

#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Modules/_stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

#include "Python.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
Expand Down Expand Up @@ -631,7 +627,3 @@ PyInit__stat(void)
{
return PyModuleDef_Init(&statmodule);
}

#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"Type \"help\", \"copyright\", \"credits\" or \"license\" " \
"for more information."

#ifdef __cplusplus
extern "C" {
#endif

/* --- pymain_init() ---------------------------------------------- */

static PyStatus
Expand Down Expand Up @@ -742,7 +738,3 @@ Py_BytesMain(int argc, char **argv)
.wchar_argv = NULL};
return pymain_main(&args);
}

#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@
#endif


#ifdef __cplusplus
extern "C" {
#endif

PyDoc_STRVAR(posix__doc__,
"This module provides access to operating system functionality that is\n\
standardized by the C Standard and the POSIX standard (a thinly\n\
Expand Down Expand Up @@ -17002,7 +16998,3 @@ INITFUNC(void)
{
return PyModuleDef_Init(&posixmodule);
}

#ifdef __cplusplus
}
#endif
9 changes: 0 additions & 9 deletions Objects/fileobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#define NEWLINE_LF 2 /* \n newline seen */
#define NEWLINE_CRLF 4 /* \r\n newline seen */

#ifdef __cplusplus
extern "C" {
#endif

/* External C interface */

PyObject *
Expand Down Expand Up @@ -539,8 +535,3 @@ _PyFile_Flush(PyObject *file)
Py_DECREF(tmp);
return 0;
}


#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
# error "Py_LIMITED_API macro must not be defined"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Defined in tracemalloc.c */
extern void _PyMem_DumpTraceback(int fd, const void *ptr);

Expand Down Expand Up @@ -2808,7 +2804,3 @@ int Py_IsFalse(PyObject *x)
{
return Py_Is(x, Py_False);
}

#ifdef __cplusplus
}
#endif
10 changes: 0 additions & 10 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ NOTE: In the interpreter's initialization phase, some globals are currently

*/


#ifdef __cplusplus
extern "C" {
#endif

// Maximum code point of Unicode 6.0: 0x10ffff (1,114,111).
// The value must be the same in fileutils.c.
#define MAX_UNICODE 0x10ffff
Expand Down Expand Up @@ -15397,8 +15392,3 @@ PyInit__string(void)
{
return PyModuleDef_Init(&_string_module);
}


#ifdef __cplusplus
}
#endif
7 changes: 0 additions & 7 deletions Python/dtoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,6 @@ typedef uint64_t ULLong;
#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef union { double d; ULong L[2]; } U;

#ifdef IEEE_8087
Expand Down Expand Up @@ -2813,8 +2809,5 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
_Py_dg_freedtoa(s0);
return NULL;
}
#ifdef __cplusplus
}
#endif

#endif // _PY_SHORT_FLOAT_REPR == 1
9 changes: 0 additions & 9 deletions Python/errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
# include <stdlib.h> // _sys_nerr
#endif


#ifdef __cplusplus
extern "C" {
#endif

/* Forward declarations */
static PyObject *
_PyErr_FormatV(PyThreadState *tstate, PyObject *exception,
Expand Down Expand Up @@ -1918,7 +1913,3 @@ PyErr_ProgramTextObject(PyObject *filename, int lineno)
{
return _PyErr_ProgramDecodedTextObject(filename, lineno, NULL);
}

#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Python/getargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
#include "pycore_pylifecycle.h" // _PyArg_Fini
#include "pycore_tuple.h" // _PyTuple_ITEMS()

#ifdef __cplusplus
extern "C" {
#endif

/* Export Stable ABIs (abi only) */
PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, const char *, ...);
PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, const char *, ...);
Expand Down Expand Up @@ -2867,7 +2863,3 @@ _PyArg_Fini(void)
}
_PyRuntime.getargs.static_parsers = NULL;
}

#ifdef __cplusplus
};
#endif
9 changes: 0 additions & 9 deletions Python/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#include <wchar.h>
#include "pycore_getopt.h"

#ifdef __cplusplus
extern "C" {
#endif

int _PyOS_opterr = 1; /* generate error messages */
Py_ssize_t _PyOS_optind = 1; /* index into argv array */
const wchar_t *_PyOS_optarg = NULL; /* optional argument */
Expand Down Expand Up @@ -172,8 +168,3 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)

return option;
}

#ifdef __cplusplus
}
#endif

8 changes: 0 additions & 8 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif


/*[clinic input]
Expand Down Expand Up @@ -3887,8 +3884,3 @@ PyInit__imp(void)
{
return PyModuleDef_Init(&imp_module);
}


#ifdef __cplusplus
}
#endif
9 changes: 0 additions & 9 deletions Python/pathconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
# include <shlwapi.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif


/* External interface */

Expand Down Expand Up @@ -500,8 +496,3 @@ _PyPathConfig_ComputeSysPath0(const PyWideStringList *argv, PyObject **path0_p)
*path0_p = path0_obj;
return 1;
}


#ifdef __cplusplus
}
#endif
8 changes: 0 additions & 8 deletions Python/pyhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
# include <sys/endian.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

_Py_HashSecret_t _Py_HashSecret = {{0}};

#if Py_HASH_ALGORITHM == Py_HASH_EXTERNAL
Expand Down Expand Up @@ -503,7 +499,3 @@ pysiphash(const void *src, Py_ssize_t src_sz) {

static PyHash_FuncDef PyHash_Func = {pysiphash, "siphash24", 64, 128};
#endif

#ifdef __cplusplus
}
#endif
9 changes: 0 additions & 9 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))


#ifdef __cplusplus
extern "C" {
#endif


/* Forward declarations */
static PyStatus add_main_module(PyInterpreterState *interp);
static PyStatus init_import_site(void);
Expand Down Expand Up @@ -3139,7 +3134,3 @@ PyOS_setsig(int sig, PyOS_sighandler_t handler)
return oldhandler;
#endif
}

#ifdef __cplusplus
}
#endif
21 changes: 6 additions & 15 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ to avoid the expense of doing their own locking).
-------------------------------------------------------------------------- */

#ifdef HAVE_DLOPEN
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#if !HAVE_DECL_RTLD_LAZY
#define RTLD_LAZY 1
#endif
#endif

#ifdef __cplusplus
extern "C" {
# ifdef HAVE_DLFCN_H
# include <dlfcn.h>
# endif
# if !HAVE_DECL_RTLD_LAZY
# define RTLD_LAZY 1
# endif
#endif


Expand Down Expand Up @@ -2985,8 +2981,3 @@ _PyThreadState_MustExit(PyThreadState *tstate)
}
return 1;
}


#ifdef __cplusplus
}
#endif
9 changes: 0 additions & 9 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
# include "windows.h"
#endif


#ifdef __cplusplus
extern "C" {
#endif

/* Forward */
static void flush_io(void);
static PyObject *run_mod(mod_ty, PyObject *, PyObject *, PyObject *,
Expand Down Expand Up @@ -2017,7 +2012,3 @@ PyRun_InteractiveLoop(FILE *f, const char *p)
{
return PyRun_InteractiveLoopFlags(f, p, NULL);
}

#ifdef __cplusplus
}
#endif
18 changes: 0 additions & 18 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2039,11 +2039,6 @@ sys_call_tracing_impl(PyObject *module, PyObject *func, PyObject *funcargs)
return _PyEval_CallTracing(func, funcargs);
}


#ifdef __cplusplus
extern "C" {
#endif

/*[clinic input]
sys._debugmallocstats

Expand Down Expand Up @@ -2072,10 +2067,6 @@ sys__debugmallocstats_impl(PyObject *module)
extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
#endif

#ifdef __cplusplus
}
#endif


/*[clinic input]
sys._clear_type_cache
Expand Down Expand Up @@ -2297,11 +2288,6 @@ sys__getframemodulename_impl(PyObject *module, int depth)
return Py_NewRef(r);
}


#ifdef __cplusplus
extern "C" {
#endif

static PerfMapState perf_map_state;

PyAPI_FUNC(int) PyUnstable_PerfMapState_Init(void) {
Expand Down Expand Up @@ -2370,10 +2356,6 @@ PyAPI_FUNC(void) PyUnstable_PerfMapState_Fini(void) {
#endif
}

#ifdef __cplusplus
}
#endif


static PyMethodDef sys_methods[] = {
/* Might as well keep this in alphabetic order */
Expand Down
Loading