From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eigenstate.org ([206.124.132.107]) by ewsd; Mon Jun 17 15:27:45 EDT 2019 Received: from eigenstate.org (localhost [127.0.0.1]) by eigenstate.org (OpenSMTPD) with ESMTP id b48e94e7 for <9front@9front.org>; Mon, 17 Jun 2019 12:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=eigenstate.org; h=date :from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; s=mail; bh=C7qLMH4jrhrVieZmggUAuzQjh sQ=; b=WxyU1UI5lekOgNsaXXPOSWPuLDjF6xu7lk/muV+RqwDBPe1MxfRvqsjlI w0UMX41xcAPE1kHwSG7qyZgor6PzzlOxR1o/Z6ChoZujWJ2/yqXf9dxPBDfoNn20 UadgkydL5IXb2VD/9GWAMfTr+cY0GHsQKy3cCR8gFX9fzEvWNY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=eigenstate.org; h=date:from :to:subject:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=mail; b=GjOQfmVP4sF/qmDnWLY aCeo3k25cBwdNt0/CD9yKyODpAv26JfrNAx7AzggsG30dTN3mm4q9/Uiu+EMMdp0 hrlpaQESPr4WhofenB62T9ABBznAbQcB1wxjuz4AxOhc9Rko7ZzJkmQRfAWmOmZ4 6/rnRJ4cn1wnz702q/xm7Pfg= Received: from zomg.markovcorp.com (markov.via.net [157.22.130.3]) by eigenstate.org (OpenSMTPD) with ESMTPSA id 79617812 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <9front@9front.org>; Mon, 17 Jun 2019 12:27:44 -0700 (PDT) Date: Mon, 17 Jun 2019 12:27:43 -0700 From: Ori Bernstein To: 9front@9front.org Subject: Cpp: handle c99 comments by default. Message-Id: <20190617122743.f698d460453a6b5f03f38da6@eigenstate.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: anonymous virtualized hypervisor hardware deep-learning framework This change makes the -+ flag default in cpp, and turns it into a no-op. 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... 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. The flag itself is retained so we don't break existing mkfiles -- but maybe we want to remove it entirely. 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 }; 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 @@ } } -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. 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 = 1; -- Ori Bernstein