diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2018-08-15 21:03:47 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2018-08-17 06:22:47 +0200 |
commit | 8bc4348cc77e5ed6ae140f70c60bf748ff4e0378 (patch) | |
tree | b44248698c81bbf35c4bf3d454f472067ceb964f | |
parent | 1113522acb86deec5b4cf75fb40b36a3279813e2 (diff) | |
download | bison-8bc4348cc77e5ed6ae140f70c60bf748ff4e0378.tar.gz |
reader: simplify the search of the start symbol
Suggested by Paul Eggert.
* src/reader.c (find_start_symbol): Don't check 'res', we know it is
not null. That suffices to avoid the GCC warnings.
* bootstrap.conf: We don't need 'assume', which doesn't exist anyway.
-rw-r--r-- | bootstrap.conf | 2 | ||||
-rw-r--r-- | src/reader.c | 16 |
2 files changed, 6 insertions, 12 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index b2d0f974..7c436a59 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -17,7 +17,7 @@ # gnulib modules used by this package. gnulib_modules=' - argmatch assert assume + argmatch assert calloc-posix close closeout config-h c-strcase configmake dirname diff --git a/src/reader.c b/src/reader.c index 12faef96..664dea71 100644 --- a/src/reader.c +++ b/src/reader.c @@ -729,17 +729,11 @@ static symbol * find_start_symbol (void) { symbol_list *res = grammar; - for (; - res && symbol_is_dummy (res->content.sym); - res = res->next) - { - for (res = res->next; - res && res->content.sym; - res = res->next) - continue; - assume (res); - } - assume (res); + /* Skip all the possible dummy rules of the first rule. */ + for (; symbol_is_dummy (res->content.sym); res = res->next) + /* Skip the LHS, and then all the RHS of the dummy rule. */ + for (res = res->next; res->content.sym; res = res->next) + continue; return res->content.sym; } |