From 76c102e548ee76884c94770e727f2ead6cfa5538 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 3 Oct 2012 18:09:53 +0200 Subject: [PATCH] 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). --- sys/src/cmd/cc/lex.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/src/cmd/cc/lex.c b/sys/src/cmd/cc/lex.c index 2652cb8f8..68a566ba0 100644 --- a/sys/src/cmd/cc/lex.c +++ b/sys/src/cmd/cc/lex.c @@ -242,14 +242,12 @@ compile(char *file, char **defs, int ndef) 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++) { sprint(opt, "-D%s", defs[c]); av[i++] = strdup(opt);