Browse Source

Plan 9 from Bell Labs 2011-10-25

David du Colombier 12 years ago
parent
commit
f4a3052737
2 changed files with 8 additions and 5 deletions
  1. 6 5
      sys/src/cmd/calls.c
  2. 2 0
      sys/src/cmd/cpp/nlist.c

+ 6 - 5
sys/src/cmd/calls.c

@@ -26,7 +26,7 @@
 
 enum {
 	Printstats =	0,		/* flag */
-	Maxseen =	400,		/* # of instances w/in a function */
+	Maxseen =	4000,		/* # of instances w/in a function */
 	Maxdepth =	300,		/* max func call tree depth */
 	Hashsize =	2048,
 
@@ -94,8 +94,7 @@ struct Root {
 };
 
 char *aseen[Maxseen];		/* names being gathered within a function */
-Rname *namelist;		/* names being tracked */
-Rnamehash nameshash[Hashsize];
+Rnamehash nameshash[Hashsize];	/* names being tracked */
 Rname *activelist[Maxdepth];	/* names being output */
 String *cppopt;
 Root *roots;
@@ -268,7 +267,7 @@ getfree(void)
 }
 
 /*
- * install (np,rp) puts a new instance of a function into the linked list.
+ * install(np, rp) puts a new instance of a function into the linked list.
  * It puts a pointer (np) to its own name (returned by place) into its
  * namepointer, a pointer to the calling routine (rp) into its called-by
  * pointer, and zero into the calls pointer.  It then puts a pointer to
@@ -325,8 +324,9 @@ newproc(char *name)
 	rp = place(name);
 	if (rp == nil)
 		return RINSTERR;
+	/* declaration in a header file is enough to cause this. */
 	if (0 && rp->rnamedefined)
-		warning("function `%s' redefined", name);
+		warning("function `%s' redeclared", name);
 	rp->rnamedefined = 1;
 	return install(rp, nil);
 }
@@ -818,6 +818,7 @@ pushclose(Pushstate *ps)
  *
  * must fork/exec cpp for each input file.
  * otherwise we get macro redefinitions and other problems.
+ * also plan 9's cpp can only process one input file per invocation.
  */
 void
 scanfiles(int argc, char **argv)

+ 2 - 0
sys/src/cmd/cpp/nlist.c

@@ -161,6 +161,8 @@ setup(int argc, char **argv)
 	dp = ".";
 	fp = "<stdin>";
 	fd = 0;
+	if (argc > 2)
+		error(FATAL, "Too many file arguments; see cpp(1)");
 	if (argc > 0) {
 		if ((fp = strrchr(argv[0], '/')) != NULL) {
 			int len = fp - argv[0];