PERFORCE change 231231 for review

Brooks Davis brooks at FreeBSD.org
Wed Jul 17 20:04:26 UTC 2013


http://p4web.freebsd.org/@@231231?ac=10

Change 231231 by brooks at brooks_zenith on 2013/07/17 20:03:42

	Remove -O* from compile entries in the expanded form of config
	generated <file>.oll rules.  This is fragile if new
	compile macros are added but that's a fairly rare occurance in
	practice.  A complete rethink of the kernel build process is
	probably warranted, but is not on today's agenda.

Affected files ...

.. //depot/projects/ctsrd/tesla/src/usr.sbin/config/mkmakefile.c#4 edit

Differences ...

==== //depot/projects/ctsrd/tesla/src/usr.sbin/config/mkmakefile.c#4 (text+ko) ====

@@ -697,9 +697,9 @@
 static void
 do_rules(FILE *f)
 {
-	char *cp, *np, och;
+	char *cp, *cwcp, *np, och, *tcp;
 	struct file_list *ftp;
-	char *compilewith;
+	char *compilewith, *teslacompilewith;
 	char cmd[128];
 
 	STAILQ_FOREACH(ftp, &ftab, f_next) {
@@ -773,6 +773,39 @@
 			fprintf(f, "\n");
 
 		if (tesla && och == 'c') {
+			int i;
+			const char *compilers[] = {
+			    "{NORMAL_C}",
+			    "{NORMAL_C_NOWERROR}",
+			    "{OFED_C}",
+			    "{PROFILE_C}",
+			    "{ZFS_C}",
+			    NULL
+			};
+
+			cwcp = NULL;
+			for(i = 0; compilers[i] != NULL; i++) {
+				if ((cwcp = strstr(compilewith, compilers[i]))
+				    == NULL)
+					continue;
+				/* Find the closing } */
+				cwcp += strlen(compilers[i]) - 1;
+				break;
+			}
+
+			if (cwcp != NULL) {
+				if ((tcp = teslacompilewith =
+				    malloc(strlen(compilewith) + 6)) == NULL)
+					err(1, "malloc\n");
+				strncpy(tcp, compilewith,
+				    cwcp - compilewith);
+				tcp += cwcp - compilewith;
+				strcpy(tcp, ":N-O*");
+				tcp += strlen(":N-O*");
+				strcpy(tcp, cwcp);
+			} else
+				teslacompilewith = compilewith;
+
 			if (ftp->f_depends)
 				fprintf(f, "%s%soll: $S/%s%c %s\n",
 					ftp->f_objprefix, tail(np), np, och,
@@ -783,11 +816,13 @@
 			if (strlen(ftp->f_objprefix))
 				fprintf(f,
 				    "\t%s $S/%s -S -emit-llvm -o ${.TARGET}\n",
-				    compilewith, np);
+				    teslacompilewith, np);
 			else
 				fprintf(f, "\t%s -S -emit-llvm -o ${.TARGET}\n",
-				    compilewith);
+				    teslacompilewith);
 			fprintf(f, "\n");
+			if (teslacompilewith != compilewith)
+				free(teslacompilewith);
 
 			if (ftp->f_depends)
 				fprintf(f, "%s%stesla: $S/%s%c %s\n",


More information about the p4-projects mailing list