Reduce header complexity

- Remove most __ASSEMBLER__ __LINKER__ ifdefs
- Rename libc/intrin/bits.h to libc/serialize.h
- Block pthread cancelation in fchmodat() polyfill
- Remove `clang-format off` statements in third_party
This commit is contained in:
Justine Tunney 2023-11-28 14:24:28 -08:00
parent 96f979dfc5
commit fa20edc44d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3057 changed files with 410 additions and 4398 deletions

View file

@ -25,7 +25,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/* Abstract Object Interface (many thanks to Jim Fulton) */

View file

@ -8,7 +8,6 @@
#include "third_party/python/Include/accu.h"
#include "third_party/python/Include/listobject.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
static PyObject *
join_list_unicode(PyObject *lst)

View file

@ -8,7 +8,6 @@
#include "third_party/python/Include/longintrepr.h"
#include "third_party/python/Include/modsupport.h"
#include "third_party/python/Include/pymacro.h"
/* clang-format off */
/* Boolean type, a subtype of int */

View file

@ -24,7 +24,6 @@
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/*[clinic input]
class bytearray "PyByteArrayObject *" "&PyByteArray_Type"

View file

@ -13,7 +13,6 @@
#include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/pyctype.h"
#include "third_party/python/Include/pyerrors.h"
/* clang-format off */
PyDoc_STRVAR_shared(_Py_isspace__doc__,
"B.isspace() -> bool\n\

View file

@ -27,7 +27,6 @@
#include "third_party/python/Include/pystrtod.h"
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/*[clinic input]
class bytes "PyBytesObject *" "&PyBytes_Type"

View file

@ -28,7 +28,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
int
_PyObject_HasFastCall(PyObject *callable)

View file

@ -10,7 +10,6 @@
#include "third_party/python/Include/pycapsule.h"
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pymacro.h"
/* clang-format off */
/* Wrap void * pointers to be passed between C modules */

View file

@ -9,7 +9,6 @@
#include "third_party/python/Include/descrobject.h"
#include "third_party/python/Include/object.h"
#include "third_party/python/Include/objimpl.h"
/* clang-format off */
PyObject *
PyCell_New(PyObject *obj)

View file

@ -16,7 +16,6 @@
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/structmember.h"
/* clang-format off */
/* Class object implementation (dead now except for methods) */

View file

@ -1,4 +1,3 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/

View file

@ -1,4 +1,3 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/

View file

@ -1,4 +1,3 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/

View file

@ -1,4 +1,3 @@
/* clang-format off */
/*[clinic input]
preserve
[clinic start generated code]*/

View file

@ -23,7 +23,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
#define NAME_CHARS \
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"

View file

@ -20,7 +20,6 @@
#include "third_party/python/Include/pymath.h"
#include "third_party/python/Include/pystrtod.h"
#include "third_party/python/Include/structmember.h"
/* clang-format off */
/* Borrows heavily from floatobject.c */
/* Submitted by Jim Hugunin */

View file

@ -17,7 +17,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
/* Descriptors -- a new, flexible way to describe attributes */

View file

@ -2,7 +2,6 @@
#define Py_DICT_COMMON_H
#include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/object.h"
/* clang-format off */
typedef struct {
/* Cached hash code of me_key. */

View file

@ -20,7 +20,6 @@
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Objects/dict-common.h"
#include "third_party/python/pyconfig.h"
/* clang-format off */
/* Dictionary object implementation using a hash table */

View file

@ -14,7 +14,6 @@
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pymacro.h"
/* clang-format off */
typedef struct {
PyObject_HEAD

View file

@ -19,7 +19,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/traceback.h"
#include "third_party/python/Include/tupleobject.h"
/* clang-format off */
/*
* New exceptions.c written in Iceland by Richard Jones and Georg Brandl.

View file

@ -23,7 +23,6 @@
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
/* File object implementation (what's left of it -- see io.py) */

View file

@ -29,7 +29,6 @@
#include "third_party/python/Include/pystrtod.h"
#include "third_party/python/Include/structseq.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/* XXX There should be overflow checks here, but it's hard to check
for any kind of float exception without losing portability. */

View file

@ -19,7 +19,6 @@
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
/* clang-format off */
#define OFF(x) offsetof(PyFrameObject, x)

View file

@ -8,7 +8,6 @@
#include "third_party/python/Include/import.h"
#include "third_party/python/Include/object.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
PYTHON_YOINK("io");

View file

@ -18,7 +18,6 @@
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
PyObject *
PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)

View file

@ -18,7 +18,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/traceback.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
static PyObject *gen_close(PyGenObject *, PyObject *);
static PyObject *async_gen_asend_new(PyAsyncGenObject *, PyObject *);

View file

@ -12,7 +12,6 @@
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pymacro.h"
/* clang-format off */
typedef struct {
PyObject_HEAD

View file

@ -21,7 +21,6 @@
#include "third_party/python/Include/pymem.h"
#include "third_party/python/Include/pystate.h"
#include "third_party/python/Include/sliceobject.h"
/* clang-format off */
/* Ensure ob_item has room for at least newsize elements, and set
* ob_size to newsize. If newsize > ob_size on entry, the content

View file

@ -26,7 +26,6 @@
#include "third_party/python/Include/structseq.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/* Long (arbitrary precision) integer object implementation */
/* XXX The functional organization of this file is terrible */

View file

@ -22,7 +22,6 @@
#include "third_party/python/Include/pystrhex.h"
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
/****************************************************************************/
/* ManagedBuffer Object */

View file

@ -15,7 +15,6 @@
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/pyhash.h"
#include "third_party/python/Include/structmember.h"
/* clang-format off */
/* Free list for method objects to safe malloc/free overhead
* The m_self element is used to chain the objects.

View file

@ -18,7 +18,6 @@
#include "third_party/python/Include/sysmodule.h"
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
static Py_ssize_t max_module_number;

View file

@ -17,7 +17,6 @@
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
typedef struct {
PyObject_HEAD

View file

@ -39,7 +39,6 @@
#include "third_party/python/Include/sysmodule.h"
#include "third_party/python/Include/traceback.h"
#include "third_party/python/Include/weakrefobject.h"
/* clang-format off */
_Py_IDENTIFIER(Py_Repr);
_Py_IDENTIFIER(__bytes__);

View file

@ -8,7 +8,6 @@
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/intrin/asan.internal.h"
#include "libc/intrin/bits.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/map.h"
@ -20,8 +19,8 @@
#include "third_party/python/Include/pylifecycle.h"
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/pymem.h"
#include "libc/serialize.h"
#include "third_party/python/Include/yoink.h"
/* clang-format off */
/* Python's malloc wrappers (see pymem.h) */

View file

@ -19,7 +19,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Objects/dict-common.h"
/* clang-format off */
/* Ordered Dictionary object implementation.

View file

@ -14,7 +14,6 @@
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
/* Support objects whose length is > PY_SSIZE_T_MAX.

View file

@ -17,7 +17,6 @@
#include "third_party/python/Include/setobject.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
/* set object implementation

View file

@ -17,7 +17,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/unicodeobject.h"
/* clang-format off */
/*
Written by Jim Hugunin and Chris Chase.

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* this is sort of a hack. there's at least one place (formatting
floats) where some stringlib code takes a different path if it's

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: codec implementations */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: count implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
#if STRINGLIB_IS_UNICODE
# error "ctype.h only compatible with byte-wise strings"

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* Fast unicode equal function optimized for dictobject.c and setobject.c */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: fastsearch implementation */

View file

@ -5,7 +5,6 @@
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
#include "third_party/python/Include/modsupport.h"
/* clang-format off */
/* stringlib: find/index implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* Finding the optimal width of unicode characters in a buffer */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: bytes joining implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* _PyUnicode_InsertThousandsGrouping() helper functions */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: partition implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: replace implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* stringlib: split implementation */

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
#ifndef STRINGLIB_STRINGDEFS_H
#define STRINGLIB_STRINGDEFS_H

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
#if STRINGLIB_IS_UNICODE
# error "transmogrify.h only compatible with byte-wise strings"

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* this is sort of a hack. there's at least one place (formatting
floats) where some stringlib code takes a different path if it's

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* this is sort of a hack. there's at least one place (formatting
floats) where some stringlib code takes a different path if it's

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/* this is sort of a hack. there's at least one place (formatting
floats) where some stringlib code takes a different path if it's

View file

@ -4,7 +4,6 @@
Python 3
https://docs.python.org/3/license.html
╚─────────────────────────────────────────────────────────────────────────────*/
/* clang-format off */
/*
unicode_format.h -- implementation of str.format().

View file

@ -11,7 +11,6 @@
#include "third_party/python/Include/modsupport.h"
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/structmember.h"
/* clang-format off */
/* Implementation helper: a struct that looks like a tuple. See timemodule
and posixmodule for example uses. */

View file

@ -17,7 +17,6 @@
#include "third_party/python/Include/pystate.h"
#include "third_party/python/Include/sliceobject.h"
#include "third_party/python/Include/tupleobject.h"
/* clang-format off */
/* Tuple object implementation */

View file

@ -30,7 +30,6 @@
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Include/warnings.h"
#include "third_party/python/Include/weakrefobject.h"
/* clang-format off */
static const short slotoffsets[] = {
-1, /* invalid slot */

View file

@ -1,4 +1,3 @@
/* clang-format off */
/* Generated by typeslots.py */
0,
0,

View file

@ -7,7 +7,6 @@
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Modules/unicodedata.h"
#include "third_party/python/Modules/unicodedata_unidata.h"
/* clang-format off */
/*
* Unicode character type helpers.

View file

@ -11,7 +11,6 @@
#include "third_party/python/Include/pymem.h"
#include "third_party/python/Include/unicodeobject.h"
#include "third_party/python/Include/warnings.h"
/* clang-format off */
#define _PyUnicode_STATE(op) \
(((PyASCIIObject *)(op))->state)

View file

@ -42,7 +42,6 @@
#include "third_party/python/Include/warnings.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/unicodedata.h"
/* clang-format off */
PYTHON_PROVIDE("_string");
PYTHON_PROVIDE("_string.__doc__");

View file

@ -12,7 +12,6 @@
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/weakrefobject.h"
#include "third_party/quickjs/quickjs.h"
/* clang-format off */
#define GET_WEAKREFS_LISTPTR(o) \
((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o))