summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-08-13 18:18:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-08-13 18:18:52 (GMT)
commit9ed5f2726607c57c894af24159b6a7ccf660da7f (patch)
treee1b779ecf1afd5d86eb955ed44b476f2d88dab10 /Parser
parent9eaa3e6732debf6a633f44cf3c82a0eaf8879a51 (diff)
downloadcpython-9ed5f2726607c57c894af24159b6a7ccf660da7f.zip
cpython-9ed5f2726607c57c894af24159b6a7ccf660da7f.tar.gz
cpython-9ed5f2726607c57c894af24159b6a7ccf660da7f.tar.bz2
Issue #18722: Remove uses of the "register" keyword in C code.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/grammar1.c6
-rw-r--r--Parser/node.c2
-rw-r--r--Parser/parser.c34
-rw-r--r--Parser/tokenizer.c12
4 files changed, 27 insertions, 27 deletions
diff --git a/Parser/grammar1.c b/Parser/grammar1.c
index 7136463..30a6f07 100644
--- a/Parser/grammar1.c
+++ b/Parser/grammar1.c
@@ -9,9 +9,9 @@
/* Return the DFA for the given type */
dfa *
-PyGrammar_FindDFA(grammar *g, register int type)
+PyGrammar_FindDFA(grammar *g, int type)
{
- register dfa *d;
+ dfa *d;
#if 1
/* Massive speed-up */
d = &g->g_dfa[type - NT_OFFSET];
@@ -19,7 +19,7 @@ PyGrammar_FindDFA(grammar *g, register int type)
return d;
#else
/* Old, slow version */
- register int i;
+ int i;
for (i = g->g_ndfas, d = g->g_dfa; --i >= 0; d++) {
if (d->d_type == type)
diff --git a/Parser/node.c b/Parser/node.c
index 1e4f0da..b26ce61 100644
--- a/Parser/node.c
+++ b/Parser/node.c
@@ -76,7 +76,7 @@ fancy_roundup(int n)
int
-PyNode_AddChild(register node *n1, int type, char *str, int lineno, int col_offset)
+PyNode_AddChild(node *n1, int type, char *str, int lineno, int col_offset)
{
const int nch = n1->n_nchildren;
int current_capacity;
diff --git a/Parser/parser.c b/Parser/parser.c
index b505fe0..fc102f2 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -35,9 +35,9 @@ s_reset(stack *s)
#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK])
static int
-s_push(register stack *s, dfa *d, node *parent)
+s_push(stack *s, dfa *d, node *parent)
{
- register stackentry *top;
+ stackentry *top;
if (s->s_top == s->s_base) {
fprintf(stderr, "s_push: parser stack overflow\n");
return E_NOMEM;
@@ -52,7 +52,7 @@ s_push(register stack *s, dfa *d, node *parent)
#ifdef Py_DEBUG
static void
-s_pop(register stack *s)
+s_pop(stack *s)
{
if (s_empty(s))
Py_FatalError("s_pop: parser stack underflow -- FATAL");
@@ -105,7 +105,7 @@ PyParser_Delete(parser_state *ps)
/* PARSER STACK OPERATIONS */
static int
-shift(register stack *s, int type, char *str, int newstate, int lineno, int col_offset)
+shift(stack *s, int type, char *str, int newstate, int lineno, int col_offset)
{
int err;
assert(!s_empty(s));
@@ -117,10 +117,10 @@ shift(register stack *s, int type, char *str, int newstate, int lineno, int col_
}
static int
-push(register stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)
+push(stack *s, int type, dfa *d, int newstate, int lineno, int col_offset)
{
int err;
- register node *n;
+ node *n;
n = s->s_top->s_parent;
assert(!s_empty(s));
err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset);
@@ -137,12 +137,12 @@ static int
classify(parser_state *ps, int type, char *str)
{
grammar *g = ps->p_grammar;
- register int n = g->g_ll.ll_nlabels;
+ int n = g->g_ll.ll_nlabels;
if (type == NAME) {
- register char *s = str;
- register label *l = g->g_ll.ll_label;
- register int i;
+ char *s = str;
+ label *l = g->g_ll.ll_label;
+ int i;
for (i = n; i > 0; i--, l++) {
if (l->lb_type != NAME || l->lb_str == NULL ||
l->lb_str[0] != s[0] ||
@@ -165,8 +165,8 @@ classify(parser_state *ps, int type, char *str)
}
{
- register label *l = g->g_ll.ll_label;
- register int i;
+ label *l = g->g_ll.ll_label;
+ int i;
for (i = n; i > 0; i--, l++) {
if (l->lb_type == type && l->lb_str == NULL) {
D(printf("It's a token we know\n"));
@@ -225,10 +225,10 @@ future_hack(parser_state *ps)
#endif /* future keyword */
int
-PyParser_AddToken(register parser_state *ps, register int type, char *str,
+PyParser_AddToken(parser_state *ps, int type, char *str,
int lineno, int col_offset, int *expected_ret)
{
- register int ilabel;
+ int ilabel;
int err;
D(printf("Token %s/'%s' ... ", _PyParser_TokenNames[type], str));
@@ -241,15 +241,15 @@ PyParser_AddToken(register parser_state *ps, register int type, char *str,
/* Loop until the token is shifted or an error occurred */
for (;;) {
/* Fetch the current dfa and state */
- register dfa *d = ps->p_stack.s_top->s_dfa;
- register state *s = &d->d_state[ps->p_stack.s_top->s_state];
+ dfa *d = ps->p_stack.s_top->s_dfa;
+ state *s = &d->d_state[ps->p_stack.s_top->s_state];
D(printf(" DFA '%s', state %d:",
d->d_name, ps->p_stack.s_top->s_state));
/* Check accelerator */
if (s->s_lower <= ilabel && ilabel < s->s_upper) {
- register int x = s->s_accel[ilabel - s->s_lower];
+ int x = s->s_accel[ilabel - s->s_lower];
if (x != -1) {
if (x & (1<<7)) {
/* Push non-terminal */
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index c4160fc..97990e9 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -874,7 +874,7 @@ PyTokenizer_Free(struct tok_state *tok)
/* Get next char, updating state; error code goes into tok->done */
static int
-tok_nextc(register struct tok_state *tok)
+tok_nextc(struct tok_state *tok)
{
for (;;) {
if (tok->cur != tok->inp) {
@@ -1071,7 +1071,7 @@ tok_nextc(register struct tok_state *tok)
/* Back-up one character */
static void
-tok_backup(register struct tok_state *tok, register int c)
+tok_backup(struct tok_state *tok, int c)
{
if (c != EOF) {
if (--tok->cur < tok->buf)
@@ -1301,9 +1301,9 @@ verify_identifier(struct tok_state *tok)
/* Get next token, after space stripping etc. */
static int
-tok_get(register struct tok_state *tok, char **p_start, char **p_end)
+tok_get(struct tok_state *tok, char **p_start, char **p_end)
{
- register int c;
+ int c;
int blankline, nonascii;
*p_start = *p_end = NULL;
@@ -1313,8 +1313,8 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
/* Get indentation level */
if (tok->atbol) {
- register int col = 0;
- register int altcol = 0;
+ int col = 0;
+ int altcol = 0;
tok->atbol = 0;
for (;;) {
c = tok_nextc(tok);