Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2cf1e3

Browse files
authored
bpo-36623: Clean parser headers and include files (GH-12253)
After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
1 parent f8716c8 commit f2cf1e3

19 files changed

Lines changed: 16 additions & 83 deletions

Doc/whatsnew/3.8.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ Changes in the Python API
814814
by the installer).
815815
(See :issue:`36085`.)
816816

817+
* The header files and functions related to pgen have been removed after its
818+
replacement by a pure Python implementation. (Contributed by Pablo Galindo
819+
in :issue:`36623`.)
820+
817821

818822
Changes in the C API
819823
--------------------

Include/bitset.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,14 @@ extern "C" {
88
/* Bitset interface */
99

1010
#define BYTE char
11-
1211
typedef BYTE *bitset;
1312

14-
bitset newbitset(int nbits);
15-
void delbitset(bitset bs);
1613
#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
17-
int addbit(bitset bs, int ibit); /* Returns 0 if already set */
18-
int samebitset(bitset bs1, bitset bs2, int nbits);
19-
void mergebitset(bitset bs1, bitset bs2, int nbits);
2014

2115
#define BITSPERBYTE (8*sizeof(BYTE))
22-
#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
23-
2416
#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
2517
#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
2618
#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
27-
#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
2819

2920
#ifdef __cplusplus
3021
}

Include/grammar.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,11 @@ typedef struct {
6666
} grammar;
6767

6868
/* FUNCTIONS */
69-
70-
grammar *newgrammar(int start);
71-
void freegrammar(grammar *g);
72-
dfa *adddfa(grammar *g, int type, const char *name);
73-
int addstate(dfa *d);
74-
void addarc(dfa *d, int from, int to, int lbl);
7569
dfa *PyGrammar_FindDFA(grammar *g, int type);
76-
77-
int addlabel(labellist *ll, int type, const char *str);
78-
int findlabel(labellist *ll, int type, const char *str);
7970
const char *PyGrammar_LabelRepr(label *lb);
80-
void translatelabels(grammar *g);
81-
82-
void addfirstsets(grammar *g);
83-
8471
void PyGrammar_AddAccelerators(grammar *g);
8572
void PyGrammar_RemoveAccelerators(grammar *);
8673

87-
void printgrammar(grammar *g, FILE *fp);
88-
void printnonterminals(grammar *g, FILE *fp);
89-
9074
#ifdef __cplusplus
9175
}
9276
#endif

Include/pgenheaders.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

Makefile.pre.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,6 @@ PYTHON_HEADERS= \
10081008
$(srcdir)/Include/osdefs.h \
10091009
$(srcdir)/Include/osmodule.h \
10101010
$(srcdir)/Include/patchlevel.h \
1011-
$(srcdir)/Include/pgenheaders.h \
10121011
$(srcdir)/Include/pyarena.h \
10131012
$(srcdir)/Include/pycapsule.h \
10141013
$(srcdir)/Include/pyctype.h \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove parser headers and related function declarations that lack
2+
implementations after the removal of pgen.

PCbuild/pythoncore.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@
175175
<ClInclude Include="..\Include\osmodule.h" />
176176
<ClInclude Include="..\Include\parsetok.h" />
177177
<ClInclude Include="..\Include\patchlevel.h" />
178-
<ClInclude Include="..\Include\pgenheaders.h" />
179178
<ClInclude Include="..\Include\pyhash.h" />
180179
<ClInclude Include="..\Include\py_curses.h" />
181180
<ClInclude Include="..\Include\pyarena.h" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@
267267
<ClInclude Include="..\Include\patchlevel.h">
268268
<Filter>Include</Filter>
269269
</ClInclude>
270-
<ClInclude Include="..\Include\pgenheaders.h">
271-
<Filter>Include</Filter>
272-
</ClInclude>
273270
<ClInclude Include="..\Include\py_curses.h">
274271
<Filter>Include</Filter>
275272
</ClInclude>

Parser/acceler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
are not part of the static data structure written on graminit.[ch]
1111
by the parser generator. */
1212

13-
#include "pgenheaders.h"
13+
#include "Python.h"
1414
#include "grammar.h"
1515
#include "node.h"
1616
#include "token.h"

Parser/grammar1.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/* Grammar subroutines needed by parser */
33

44
#include "Python.h"
5-
#include "pgenheaders.h"
65
#include "grammar.h"
76
#include "token.h"
87

0 commit comments

Comments
 (0)