summaryrefslogtreecommitdiff
path: root/src/symlist.c
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2015-01-13 14:43:02 +0100
committerAkim Demaille <akim@lrde.epita.fr>2015-01-13 14:45:15 +0100
commitdfd5b89d017bda9801814a5d817f8ab1095e1443 (patch)
treecf9bc8266451ac742c2b14353b538db04feb9aa8 /src/symlist.c
parent13e294ee552428507327e9fd085b46d594e434c5 (diff)
parentca5a716303f9262572764671ce4e51a0a08d4c94 (diff)
downloadbison-dfd5b89d017bda9801814a5d817f8ab1095e1443.tar.gz
Merge remote-tracking branch 'origin/maint'
* origin/maint: tests: split a large test case into several smaller ones package: a bit of trouble shooting indications doc: liby's main arms the internationalization bison: avoid warnings from static code analysis c++: fix the use of destructors when variants are enabled style: tests: simplify the handling of some C++ tests c++: symbols can be empty, so use it c++: variants: don't leak the lookahead in error recovery c++: provide a means to clear symbols c++: clean up the handling of empty symbols c++: comment and style changes c++: variants: comparing addresses of typeid.name() is undefined c++: locations: complete the API and fix comments build: do not clean figure sources in make clean
Diffstat (limited to 'src/symlist.c')
-rw-r--r--src/symlist.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/symlist.c b/src/symlist.c
index 38f5fc8d..d70763b0 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -21,7 +21,6 @@
#include <config.h>
#include "system.h"
-#include "complain.h"
#include "symlist.h"
/*--------------------------------------.
@@ -174,22 +173,17 @@ symbol_list *
symbol_list_n_get (symbol_list *l, int n)
{
int i;
-
- if (n < 0)
- return NULL;
-
+ aver (0 <= n);
for (i = 0; i < n; ++i)
{
l = l->next;
- if (l == NULL
- || (l->content_type == SYMLIST_SYMBOL && l->content.sym == NULL))
- return NULL;
+ aver (l);
}
-
+ aver (l->content_type == SYMLIST_SYMBOL);
+ aver (l->content.sym);
return l;
}
-
/*--------------------------------------------------------------.
| Get the data type (alternative in the union) of the value for |
| symbol N in symbol list L. |
@@ -198,21 +192,14 @@ symbol_list_n_get (symbol_list *l, int n)
uniqstr
symbol_list_n_type_name_get (symbol_list *l, location loc, int n)
{
- l = symbol_list_n_get (l, n);
- if (!l)
- {
- complain (&loc, complaint, _("invalid $ value: $%d"), n);
- return NULL;
- }
- aver (l->content_type == SYMLIST_SYMBOL);
- return l->content.sym->content->type_name;
+ return symbol_list_n_get (l, n)->content.sym->content->type_name;
}
bool
symbol_list_null (symbol_list *node)
{
- return !node ||
- (node->content_type == SYMLIST_SYMBOL && !(node->content.sym));
+ return (!node
+ || (node->content_type == SYMLIST_SYMBOL && !node->content.sym));
}
void