git: 9front

Download patch

ref: 0b8e3ffbbafd1b91ae6f048ed3565743edcc1825
parent: ec6edc7e8292a1717615c30cf7fba72a5e9c7b4b
author: cinap_lenrek <cinap_lenrek@gmx.de>
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++) {
--