Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move static statements to footer and add newline
  • Loading branch information
jkchandalia committed May 2, 2023
commit db9a1e9dec1cb3a1d5dbaf0eaa80ef772a31829c
3 changes: 2 additions & 1 deletion Include/internal/pycore_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#define INTRINSIC_PREP_RERAISE_STAR 1

#define MAX_INTRINSIC_2 1

typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);
typedef PyObject *(*instrinsic_func2)(PyThreadState* tstate, PyObject *value1, PyObject *value2);
extern const instrinsic_func1 _PyIntrinsics_UnaryFunctions[];
extern const instrinsic_func2 _PyIntrinsics_BinaryFunctions[];
extern const instrinsic_func2 _PyIntrinsics_BinaryFunctions[];
19 changes: 8 additions & 11 deletions Tools/build/generate_opcode_h.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@

""".lstrip()

intrinsic_footer = """
typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);
typedef PyObject *(*instrinsic_func2)(PyThreadState* tstate, PyObject *value1, PyObject *value2);
extern const instrinsic_func1 _PyIntrinsics_UnaryFunctions[];
extern const instrinsic_func2 _PyIntrinsics_BinaryFunctions[];
"""

DEFINE = "#define {:<38} {:>3}\n"

UINT32_MASK = (1<<32)-1
Expand Down Expand Up @@ -195,17 +202,7 @@ def main(opcode_py, outfile='Include/opcode.h',
nobj.write("\n")
nobj.write(DEFINE.format("MAX_INTRINSIC_2", i))

nobj.write(
"typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);"
)
nobj.write("\n")
nobj.write(
"typedef PyObject *(*instrinsic_func2)(PyThreadState* tstate, PyObject *value1, PyObject *value2);"
)
nobj.write("\n")
nobj.write("extern const instrinsic_func1 _PyIntrinsics_UnaryFunctions[];")
nobj.write("\n")
nobj.write("extern const instrinsic_func2 _PyIntrinsics_BinaryFunctions[];")
nobj.write(intrinsic_footer)

fobj.write("\n")
fobj.write("/* Defined in Lib/opcode.py */\n")
Expand Down