code: plan9front

Download patch

ref: 94fb8869dfba9e09afa9f64a37302dc444393766
parent: ff344562dbefe0e53adc900b6e7cd962ae555e94
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jun 18 18:47:15 EDT 2019

Always turn on the -+ flag in cpp

C99 comments have been the default in compilers for something like 20 years
now. This means we don't need to remember to turn it on when porting software,
and gets rid of cryptic errors about unterminated character constants when
someone writes something like:

	// Didn't need to...

We still accept the flag to avoid breaking mkfiles, but we do nothing with it.

This also removes the documentation, since the option does nothing now.

--- a/sys/man/1/cpp
+++ b/sys/man/1/cpp
@@ -67,9 +67,6 @@
 .RB `` #line ''
 directives into the output.
 .TP
-.B -+
-Understand C++ comments.
-.TP
 .B -.
 Inhibit include search in the source's directory.
 .TP
--- a/sys/man/1/pcc
+++ b/sys/man/1/pcc
@@ -25,11 +25,6 @@
 .IR 2l (1).
 The options are:
 .TP \w'\fL-D\ \fIname=def\ 'u
-.B "-+
-Accept C++
-.B //
-comments.
-.TP
 .BI -o " out"
 Place loader output in file
 .I out
--- a/sys/src/cmd/cpp/cpp.c
+++ b/sys/src/cmd/cpp/cpp.c
@@ -28,7 +28,6 @@
 	maketokenrow(3, &tr);
 	expandlex();
 	setup(argc, argv);
-	fixlex();
 	iniths();
 	genline();
 	process(&tr);
--- a/sys/src/cmd/cpp/cpp.h
+++ b/sys/src/cmd/cpp/cpp.h
@@ -86,7 +86,6 @@
 enum errtype { WARNING, ERROR, FATAL };
 
 void	expandlex(void);
-void	fixlex(void);
 void	setup(int, char **);
 #define gettokens cpp_gettokens
 int	gettokens(Tokenrow *, int);
--- a/sys/src/cmd/cpp/lex.c
+++ b/sys/src/cmd/cpp/lex.c
@@ -285,14 +285,6 @@
 	}
 }
 
-void
-fixlex(void)
-{
-	/* do C++ comments? */
-	if (Cplusplus==0)
-		bigfsm['/'][COM1] = bigfsm['x'][COM1];
-}
-
 /*
  * fill in a row of tokens from input, terminated by NL or END
  * First token is put at trp->lp.
--- a/sys/src/cmd/cpp/nlist.c
+++ b/sys/src/cmd/cpp/nlist.c
@@ -8,7 +8,6 @@
 extern	int	optind;
 int	verbose;
 int	Mflag;
-int	Cplusplus;
 int	nolineinfo;
 Nlist	*kwdefined;
 char	wd[128];
@@ -142,7 +141,7 @@
 			verbose++;
 			break;
 		case '+':
-			Cplusplus++;
+			/* Ignored for compatibility */
 			break;
 		case 'i':
 			debuginclude++;
--- a/sys/src/cmd/pcc.c
+++ b/sys/src/cmd/pcc.c
@@ -65,7 +65,7 @@
 	while(argc > 0) {
 		ARGBEGIN {
 		case '+':
-			append(&cpp, smprint("-%c", ARGC()));
+			/* No-op for compatibility */
 			break;
 		case 'c':
 			cflag = 1;