summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-07-09 01:07:52 -0700
committerOri Bernstein <ori@eigenstate.org>2017-07-09 01:07:52 -0700
commit25d91f98a97df36e1da381b273219ceedf256a4d (patch)
tree96f15e3a43f16057cfc0babd96288428131fd763
parent2dc7f1dc369c28ef9967e8f46248f33a8c99e0ad (diff)
downloadmc-25d91f98a97df36e1da381b273219ceedf256a4d.tar.gz
Don't allow hidden decls to clobber each other.
Hidden decls are still global, which means that if two modules define them, they are going to alias to the same symbol. This can lead to really painful to debug errors, since writes to one variable that seems to be file-local will cause some other variable in some other unrelated file to get clobbered. This turns the situation into a compile-time error.
-rw-r--r--parse/stab.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse/stab.c b/parse/stab.c
index 50a9fca..e380afd 100644
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -264,7 +264,7 @@ static int mergedecl(Node *old, Node *new)
{
Node *e, *g;
- if (old->decl.ishidden || new->decl.ishidden) {
+ if (old->decl.isimport && new->decl.isimport) {
old->decl.ishidden = old->decl.ishidden && new->decl.ishidden;
return 1;
}