shithub: riscv

Download patch

ref: 76c102e548ee76884c94770e727f2ead6cfa5538
parent: 87b66bade20523cbaa4368acab277994efd19ce8
author: cinap_lenrek <[email protected]>
date: Wed Oct 3 14:09:53 EDT 2012

apply sources patch cc-cpp-c99-comm

When running "?c -p ...", ensure the backend cpp recognizes C++ comments.

2c(1) states that the compilers recognize // comments, and the bare compilers
do.  But if you invoke the compiler with '-p', the backend cpp process
doesn't handle // comments properly unless you also give ?c the undocumented
'-+' option (which it passes through to cpp).

--- a/sys/src/cmd/cc/lex.c
+++ b/sys/src/cmd/cc/lex.c
@@ -242,12 +242,10 @@
 			close(fd[1]);
 			av[0] = CPP;
 			i = 1;
+			sprint(opt, "-+");
+			av[i++] = strdup(opt);
 			if(debug['.']){
 				sprint(opt, "-.");
-				av[i++] = strdup(opt);
-			}
-			if(debug['+']) {
-				sprint(opt, "-+");
 				av[i++] = strdup(opt);
 			}
 			for(c = 0; c < ndef; c++) {