shithub: mc

Download patch

ref: 25d91f98a97df36e1da381b273219ceedf256a4d
parent: 2dc7f1dc369c28ef9967e8f46248f33a8c99e0ad
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 8 21:07:52 EDT 2017

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.

--- a/parse/stab.c
+++ b/parse/stab.c
@@ -264,7 +264,7 @@
 {
 	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;
 	}