[hackers] [scc] Fix install() || Roberto E. Vargas Caballero
commit 66915c0956d505bf60140ff48021c0725edfa02c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Aug 13 09:43:58 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Aug 13 09:43:58 2015 +0200
Fix install()
Install() failed when we wanted install a symbol in a different
namespace where it was looked, and it was not declared.
diff --git a/cc1/symbol.c b/cc1/symbol.c
index 19ef002..e67784d 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -247,13 +247,18 @@ Symbol *
install(unsigned ns, Symbol *sym)
{
if (sym->ctx == curctx) {
- if (sym->flags & ISDECLARED)
- return NULL;
- sym->flags |= ISDECLARED;
- } else {
- sym = linkhash(newsym(ns), sym->name);
+ if (sym->flags & ISDECLARED) {
+ if (ns == sym->ns)
+ return NULL;
+ } else {
+ sym->flags |= ISDECLARED;
+ sym->ns = ns;
+ goto assign_id;
+ }
}
+ sym = linkhash(newsym(ns), sym->name);
+assign_id:
if (sym->ns != NS_CPP)
sym->id = (curctx) ? ++localcnt : ++globalcnt;
Received on Thu Aug 13 2015 - 20:02:10 CEST
This archive was generated by hypermail 2.3.0
: Thu Aug 13 2015 - 20:12:11 CEST