From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from a-painless.mh.aa.net.uk ([81.187.30.51]) by ewsd; Mon Jun 17 18:19:17 EDT 2019 Received: from 132.198.187.81.in-addr.arpa ([81.187.198.132] helo=quintile.net) by a-painless.mh.aa.net.uk with esmtp (Exim 4.89) (envelope-from ) id 1hczxm-0001wb-96 for 9front@9front.org; Mon, 17 Jun 2019 23:18:54 +0100 Received: from 5.4.c.a.6.0.1.e.4.7.f.0.e.b.c.1.4.4.e.f.e.b.a.f.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:fabe:fe44:1cbe:f74:e106:ac45]) by quintile.net; Mon Jun 17 23:18:51 BST 2019 From: Steve Simon Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: [9front] Cpp: handle c99 comments by default. Date: Mon, 17 Jun 2019 23:18:51 +0100 References: <20190617122743.f698d460453a6b5f03f38da6@eigenstate.org> To: 9front@9front.org In-Reply-To: <20190617122743.f698d460453a6b5f03f38da6@eigenstate.org> Message-Id: X-Mailer: Apple Mail (2.3445.104.8) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: open-source app event dependency manager I think the rational was that the compiler tried very hard to be c89 = compliant and c89 does not Include c++ comments by default. Perhaps, it should default to on for the pcc command but still default = to off for the c89 command. The c99 command (if there ever is on would have it on too fo course=E2=80=A6= ). -Steve > On 17 Jun 2019, at 20:27, Ori Bernstein wrote: >=20 > This change makes the -+ flag default in cpp, and turns it into a = no-op. >=20 > 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: >=20 > // Didn't need to... >=20 > I didn't add a way to turn the option off. All of our software works = under > this change, and I can't imagine any place we care that // is a syntax = error > rather than a comment. >=20 > The flag itself is retained so we don't break existing mkfiles -- but = maybe > we want to remove it entirely. >=20 > diff -r 40949afe3df8 sys/src/cmd/cpp/cpp.c > --- a/sys/src/cmd/cpp/cpp.c Mon Jun 17 13:17:16 2019 +0930 > +++ b/sys/src/cmd/cpp/cpp.c Mon Jun 17 12:19:36 2019 -0700 > @@ -28,7 +28,6 @@ > maketokenrow(3, &tr); > expandlex(); > setup(argc, argv); > - fixlex(); > iniths(); > genline(); > process(&tr); > diff -r 40949afe3df8 sys/src/cmd/cpp/cpp.h > --- a/sys/src/cmd/cpp/cpp.h Mon Jun 17 13:17:16 2019 +0930 > +++ b/sys/src/cmd/cpp/cpp.h Mon Jun 17 12:19:36 2019 -0700 > @@ -86,7 +86,6 @@ > enum errtype { WARNING, ERROR, FATAL }; >=20 > void expandlex(void); > -void fixlex(void); > void setup(int, char **); > #define gettokens cpp_gettokens > int gettokens(Tokenrow *, int); > diff -r 40949afe3df8 sys/src/cmd/cpp/lex.c > --- a/sys/src/cmd/cpp/lex.c Mon Jun 17 13:17:16 2019 +0930 > +++ b/sys/src/cmd/cpp/lex.c Mon Jun 17 12:19:36 2019 -0700 > @@ -285,14 +285,6 @@ > } > } >=20 > -void > -fixlex(void) > -{ > - /* do C++ comments? */ > - if (Cplusplus=3D=3D0) > - bigfsm['/'][COM1] =3D bigfsm['x'][COM1]; > -} > - > /* > * fill in a row of tokens from input, terminated by NL or END > * First token is put at trp->lp. > diff -r 40949afe3df8 sys/src/cmd/cpp/nlist.c > --- a/sys/src/cmd/cpp/nlist.c Mon Jun 17 13:17:16 2019 +0930 > +++ b/sys/src/cmd/cpp/nlist.c Mon Jun 17 12:19:36 2019 -0700 > @@ -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++; > diff -r 40949afe3df8 sys/src/cmd/pcc.c > --- a/sys/src/cmd/pcc.c Mon Jun 17 13:17:16 2019 +0930 > +++ b/sys/src/cmd/pcc.c Mon Jun 17 12:19:36 2019 -0700 > @@ -65,7 +65,7 @@ > while(argc > 0) { > ARGBEGIN { > case '+': > - append(&cpp, smprint("-%c", ARGC())); > + /* No-op for compatibility */ > break; > case 'c': > cflag =3D 1; >=20 >=20 > --=20 > Ori Bernstein