mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
bison: avoid warnings from static code analysis
A static analysis tool reports that some callers of symbol_list_n_get might get NULL and not handle it properly. This is not the case, yet we can suppress this pattern. Reported by Mike Sullivan. <https://lists.gnu.org/archive/html/bug-bison/2013-12/msg00027.html> * src/symlist.c (symbol_list_n_get): Actually it is never called to return 0. Enforce this postcondition via aver. (symbol_list_n_type_name_get): Simplify accordingly. In particular, discards a (translated) useless error message. * src/symlist.h: Adjust documentation. * src/scan-code.l: Style change.
This commit is contained in:
@@ -116,7 +116,10 @@ void symbol_list_free (symbol_list *list);
|
||||
/** Return the length of \c l. */
|
||||
int symbol_list_length (symbol_list const *l);
|
||||
|
||||
/** Get item \c n in symbol list \c l. */
|
||||
/** Get item \c n in symbol list \c l.
|
||||
** \pre 0 <= n
|
||||
** \post res != NULL
|
||||
**/
|
||||
symbol_list *symbol_list_n_get (symbol_list *l, int n);
|
||||
|
||||
/* Get the data type (alternative in the union) of the value for
|
||||
|
||||
Reference in New Issue
Block a user