]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110079: Remove extern "C" { ...} in C code (#110080)
authorVictor Stinner <vstinner@python.org>
Fri, 29 Sep 2023 08:56:49 +0000 (10:56 +0200)
committerGitHub <noreply@github.com>
Fri, 29 Sep 2023 08:56:49 +0000 (10:56 +0200)
18 files changed:
Modules/_scproxy.c
Modules/_stat.c
Modules/main.c
Modules/posixmodule.c
Objects/fileobject.c
Objects/object.c
Objects/unicodeobject.c
Python/dtoa.c
Python/errors.c
Python/getargs.c
Python/getopt.c
Python/import.c
Python/pathconfig.c
Python/pyhash.c
Python/pylifecycle.c
Python/pystate.c
Python/pythonrun.c
Python/sysmodule.c

index 0df0324df55f7d4259f26c90ec0dee65678b1071..6cc09088bdc869ba8f8899a39f606f1bc678aafd 100644 (file)
@@ -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
index 6cea26175dee5e76d5397cfdb6d011387a2e9e4d..3fd951b6fc1022c6adac20ea48e51b61bede32a5 100644 (file)
 
 #include "Python.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif /* HAVE_SYS_TYPES_H */
@@ -631,7 +627,3 @@ PyInit__stat(void)
 {
     return PyModuleDef_Init(&statmodule);
 }
-
-#ifdef __cplusplus
-}
-#endif
index 7f88c97207475b953314479a674e0a5c6d4e8187..05bedff050699fa73a860b959741475e83f3f49b 100644 (file)
     "Type \"help\", \"copyright\", \"credits\" or \"license\" " \
     "for more information."
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* --- pymain_init() ---------------------------------------------- */
 
 static PyStatus
@@ -742,7 +738,3 @@ Py_BytesMain(int argc, char **argv)
         .wchar_argv = NULL};
     return pymain_main(&args);
 }
-
-#ifdef __cplusplus
-}
-#endif
index abf449e25493face4fe38fc3ca8cf133004b414f..d7d3e365d2c553faf0649ce5382b56f80b1269dd 100644 (file)
 #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\
@@ -17002,7 +16998,3 @@ INITFUNC(void)
 {
     return PyModuleDef_Init(&posixmodule);
 }
-
-#ifdef __cplusplus
-}
-#endif
index 0cf2b47c3b3ae7d5f6bcda040ee08ab72c89886f..066172baf9f0273428142f2987673a2359619a59 100644 (file)
 #define NEWLINE_LF 2            /* \n newline seen */
 #define NEWLINE_CRLF 4          /* \r\n newline seen */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* External C interface */
 
 PyObject *
@@ -539,8 +535,3 @@ _PyFile_Flush(PyObject *file)
     Py_DECREF(tmp);
     return 0;
 }
-
-
-#ifdef __cplusplus
-}
-#endif
index 15c2bf65de6acfeb51ac6ff0ef928a1abf995de1..3ed272afdced7c6f32acf7be7df439244fd7ead1 100644 (file)
 #  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);
 
@@ -2808,7 +2804,3 @@ int Py_IsFalse(PyObject *x)
 {
     return Py_Is(x, Py_False);
 }
-
-#ifdef __cplusplus
-}
-#endif
index aca28e4842d6450542e0f009f671c4192ae12c42..49981a1f881c21188b7582361d9f4c7db70ed920 100644 (file)
@@ -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
@@ -15397,8 +15392,3 @@ PyInit__string(void)
 {
     return PyModuleDef_Init(&_string_module);
 }
-
-
-#ifdef __cplusplus
-}
-#endif
index c5e343b82f74c50c3f2512a752a5b9fa35e1f05f..5dfc0e179cbc348809f6902c029347ad82e6282c 100644 (file)
@@ -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
@@ -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
index b05b3ef1dda8fe9593d0bd1816e85ac42dd857e6..15af39b10dc07eff438658e98cbe10e688f7cb81 100644 (file)
 #  include <stdlib.h>             // _sys_nerr
 #endif
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Forward declarations */
 static PyObject *
 _PyErr_FormatV(PyThreadState *tstate, PyObject *exception,
@@ -1918,7 +1913,3 @@ PyErr_ProgramTextObject(PyObject *filename, int lineno)
 {
     return _PyErr_ProgramDecodedTextObject(filename, lineno, NULL);
 }
-
-#ifdef __cplusplus
-}
-#endif
index cbfe561111176cc915a2c4053066d0021bdd4b71..d590e2e153389e9076ebda6921c860464536e6ef 100644 (file)
@@ -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 *, ...);
@@ -2867,7 +2863,3 @@ _PyArg_Fini(void)
     }
     _PyRuntime.getargs.static_parsers = NULL;
 }
-
-#ifdef __cplusplus
-};
-#endif
index 4135bf1446ecfc76a4e809729257b39ba7fd47c6..f64c89fa22734ae01d7ed74d07c2aebb592153e1 100644 (file)
 #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       */
@@ -172,8 +168,3 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
 
     return option;
 }
-
-#ifdef __cplusplus
-}
-#endif
-
index 5a06cb367e828b84533ba693d453f9517ccc87e9..5636968ed9e63bdfe5757ec2b3d60452d4e0b785 100644 (file)
@@ -24,9 +24,6 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef __cplusplus
-extern "C" {
-#endif
 
 
 /*[clinic input]
@@ -3887,8 +3884,3 @@ PyInit__imp(void)
 {
     return PyModuleDef_Init(&imp_module);
 }
-
-
-#ifdef __cplusplus
-}
-#endif
index 0ac64ec811025938ecf7ee3efb995c6e6c87aebc..50c60093cd4e329bee150e3986e54bcdc40e0fb7 100644 (file)
 #  include <shlwapi.h>
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 
 /* External interface */
 
@@ -500,8 +496,3 @@ _PyPathConfig_ComputeSysPath0(const PyWideStringList *argv, PyObject **path0_p)
     *path0_p = path0_obj;
     return 1;
 }
-
-
-#ifdef __cplusplus
-}
-#endif
index b2bdab5099d86a581245590b30e0db6987d5a69e..f9060b8003a0a7d927d3d6790b045fb11639eb9c 100644 (file)
 #  include <sys/endian.h>
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 _Py_HashSecret_t _Py_HashSecret = {{0}};
 
 #if Py_HASH_ALGORITHM == Py_HASH_EXTERNAL
@@ -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
index aec8da10249d21d5103988575f48735459e0fcf3..23f66ec3601df6e764e8bc927e73d820709dabde 100644 (file)
 #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);
@@ -3139,7 +3134,3 @@ PyOS_setsig(int sig, PyOS_sighandler_t handler)
     return oldhandler;
 #endif
 }
-
-#ifdef __cplusplus
-}
-#endif
index 570b5242600c0cfb31a8d19ce31c76ecd78ff017..01aa2552e56f0de9f84a2ebe7e8561c19902143d 100644 (file)
@@ -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
 
 
@@ -2985,8 +2981,3 @@ _PyThreadState_MustExit(PyThreadState *tstate)
     }
     return 1;
 }
-
-
-#ifdef __cplusplus
-}
-#endif
index 81ab78e95ab68c48461ea4c9d2ebfc575ca737d5..1b282aa870bfd2cbcd40a321a9a3d57352e92ef7 100644 (file)
 #  include "windows.h"
 #endif
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* Forward */
 static void flush_io(void);
 static PyObject *run_mod(mod_ty, PyObject *, PyObject *, PyObject *,
@@ -2017,7 +2012,3 @@ PyRun_InteractiveLoop(FILE *f, const char *p)
 {
     return PyRun_InteractiveLoopFlags(f, p, NULL);
 }
-
-#ifdef __cplusplus
-}
-#endif
index 9c1ee0215d7cf6b3976198800ba53599013df84c..7ba7be10aacb925f49c7a33f69fe3f0506ce3586 100644 (file)
@@ -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
 
@@ -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
@@ -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) {
@@ -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 */