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/main.c | |
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/main.c')
-rw-r--r-- | src/main.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -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; |