diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2021-04-05 07:57:59 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2021-04-05 08:16:14 +0300 |
commit | c03388de6e2e63dd75abe91e63b237e1f29ecf99 (patch) | |
tree | 48a9fd66c9eabd13d29ceb481f3ca1b156753442 /src | |
parent | a0a105921a208959fad04dc37b04eb60982aab9e (diff) | |
download | cflow-c03388de6e2e63dd75abe91e63b237e1f29ecf99.tar.gz cflow-c03388de6e2e63dd75abe91e63b237e1f29ecf99.tar.bz2 |
Version 1.6.92
* NEWS: Update.
* configure.ac: Version 1.6.92
* po/POTFILES.in: Add missing file.
* src/main.c (symbol_override): Detect cyclic definitions.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/main.c | 20 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index bf54731..b8920a3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,9 +31,8 @@ cflow_SOURCES = \ posix.c\ rc.c\ symbol.c\ - wordsplit/wordsplit.c - -nodist_cflow_SOURCES = wordsplit/wordsplit.h + wordsplit/wordsplit.c\ + wordsplit/wordsplit.h localedir = $(datadir)/locale @@ -272,10 +272,24 @@ symbol_override(const char *str) error(EX_USAGE, 0, _("%s: no symbol type supplied"), str); else { name = strndup(str, ptr - str); + if (!name) + xalloc_die(); if (ptr[1] == '=') { - Symbol *alias = lookup(ptr+2); - if (!alias) { - alias = install(xstrdup(ptr+2), INSTALL_OVERWRITE); + Symbol *alias; + + ptr += 2; + if (strcmp(name, ptr) == 0) { + error(EX_USAGE, 0, _("cyclic alias: %s -> %s"), name, ptr); + } + + alias = lookup(ptr); + if (alias) { + if (strcmp(alias->name, name) == 0) { + error(EX_USAGE, 0, _("cyclic alias: %s -> %s -> %s"), + name, ptr, alias->name); + } + } else { + alias = install(xstrdup(ptr), INSTALL_OVERWRITE); alias->type = SymToken; alias->token_type = 0; alias->source = NULL; |