From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Garvin Newsgroups: gmane.emacs.bugs Subject: bug#64204: C/C++ local variables not syntax highlighted if they start with $ Date: Tue, 20 Jun 2023 15:54:52 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008befcb05fe95dde6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10397"; mail-complaints-to="usenet@ciao.gmane.io" To: 64204@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 21 13:28:44 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBw0y-0002Wx-IC for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Jun 2023 13:28:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBw0T-0002I1-GG; Wed, 21 Jun 2023 07:28:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBw0Q-0002Fd-VK for bug-gnu-emacs@gnu.org; Wed, 21 Jun 2023 07:28:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qBw0I-0001Ly-Va for bug-gnu-emacs@gnu.org; Wed, 21 Jun 2023 07:28:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBw0I-0001T9-Lv for bug-gnu-emacs@gnu.org; Wed, 21 Jun 2023 07:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Garvin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Jun 2023 11:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64204 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16873468625598 (code B ref -1); Wed, 21 Jun 2023 11:28:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jun 2023 11:27:42 +0000 Original-Received: from localhost ([127.0.0.1]:60777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBvzx-0001SB-Gc for submit@debbugs.gnu.org; Wed, 21 Jun 2023 07:27:42 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39410) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBiNa-000709-UL for submit@debbugs.gnu.org; Tue, 20 Jun 2023 16:55:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBiNa-00030W-1Q for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 16:55:10 -0400 Original-Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qBiNW-000237-Nu for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 16:55:09 -0400 Original-Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso4244620a12.3 for ; Tue, 20 Jun 2023 13:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687294504; x=1689886504; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=UFi5bIhS1EXg8dXga8ZKmIyQTLsyZ73Xa7nWVBzCB9I=; b=WFBc0L//yPGMOJdhwFOhMf1BSBVgyGALGfq9pKZZQPCyClFUwoxBUXP+n3HiT9Pcsg qa3kOY6qjKYbnvIpG54OGsdyuCfXto3oNi+bybpZPh2VpCvPOo2HHywQKo1IWjfwZerL mau76C8J0Rg33Ri53g4gi9CxBH1ySeRiiMiMGR2T4zYyFiJ2V3fPHQLQ4HOvWKSZTmjB SRQKBILeh7SAz/YmTYWraZ9NHsH5FbfKoGS8MRirU8nOqiPtNMbLwj2/GOhXWouOfpKL XswZ9Ns11Gw2l5b5rxInrtN0Na8awWogGAZW9tkRKWExv2s8+TiBwv6v6L5f3+KnbEVL k6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687294504; x=1689886504; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UFi5bIhS1EXg8dXga8ZKmIyQTLsyZ73Xa7nWVBzCB9I=; b=U8dOQ9NhF9lWA0yg1Ni+xc1604logpCiUmQVWkkVoYpr8ycSPSvhbx7LPojejeYQbs 7heT03vsjHPVdIXiQlnp0uCEtB9cltBcMwqfuwJvEyibUciakFslA8AXf5ZEVJhHh7tj FEL9itaVLGoR3fGRU4pVZuTMT0SVnVvYgiIkr/i2Lb2k8xhy0ONwoPff5zxlGXTj6CCD 5XLTpbaBufif5qFAVUviOPCdxMDXWUFb1YXB3EYXlXTkk206E6DjPz+uNURUiOiqOOKA Vf6KXIbFZg74CCs0zP0VLvAw5Ipx6YRmxPUx0Hu8QHooL4ZsvUGgKxG6M6IGy3yGHHD7 A2aw== X-Gm-Message-State: AC+VfDwtK4M1/K7WINuv3qlze8+iVKkMANgbSmUBrJi+KpUmttiiKMzf UTmgfUmlsaHc8S8Jx0JRnH+JedAfNGgTcxbq3BHn1UjeZ2Q= X-Google-Smtp-Source: ACHHUZ6eiX78drulCEDs76sf751HA++M4v8JlgvPUY/A5uuq7vOPuJ05Nj5joQthOKzb/uP5+KCx8qlzaZbOgXiD8vY= X-Received: by 2002:a05:6a20:42a2:b0:122:15d8:26ee with SMTP id o34-20020a056a2042a200b0012215d826eemr5976555pzj.45.1687294504069; Tue, 20 Jun 2023 13:55:04 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=k04jg02@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Jun 2023 07:27:39 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263804 Archived-At: --0000000000008befcb05fe95dde6 Content-Type: text/plain; charset="UTF-8" Start emacs with `emacs -Q`, press C-x C-f and type in a filename that ends in .cpp like "foo.cpp". Then type in: int main() { int a = 0; int b = 0; int $ = 0; int d$ = 0; int $e = 0; } Yes it compiles! GCC, Clang, and MSVC all have a non-standard extension that allows $ signs to appear in C/C++ variable and type names: https://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html Then a,b,d$ will be highlighted correctly as local vars, but not $ or $e. The highlighting doesn't appear to work whenever $ is the first or only character. Since emacs is accepting of the $ sign anywhere else in the variable name, I suspect supporting $ was intended, even though it's non-standard. Even if not intended, it's a popular syntax extension supported by the major current compilers and whose history goes back to the DEC compiler, so support would be nice. In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2021-05-14 built on eruv Repository revision: efc24f1e0bb127481bcc9c3054c57c4cd3c99aa9 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.6 LTS --0000000000008befcb05fe95dde6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Start emacs with `emacs -Q`, press C-x C-f and type in a f= ilename that
ends in .cpp like "foo.cpp". Then type in:
int main()
{
=C2=A0 =C2=A0 int a =3D 0;
=C2=A0 =C2=A0 int b =3D 0= ;
=C2=A0 =C2=A0 int $ =3D 0;
=C2=A0 =C2=A0 int d$ =3D 0;
=C2=A0 = =C2=A0 int $e =3D 0;
}

Yes it compiles! GCC, Clang, and MSVC all = have a non-standard
extension that allows $ signs to appear in C/C++ va= riable and type
names: https://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html=

Then a,b,d$ will be highlighted correctly as local vars, but no= t $ or
$e. The highlighting doesn't appear to work whenever $ is the= first or
only character. Since emacs is accepting of the $ sign anywher= e else in
the variable name, I suspect supporting $ was intended, even t= hough it's
non-standard. Even if not intended, it's a popular sy= ntax
extension supported by the major current compilers and whose histor= y
goes back to the DEC compiler, so support would be nice.

In GNU= Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16= .0, Xaw3d scroll bars)
=C2=A0of 2021-05-14 built on eruv
Repository r= evision: efc24f1e0bb127481bcc9c3054c57c4cd3c99aa9
Repository branch: mas= ter
Windowing system distributor 'The X.Org Foundation', version= 11.0.12013000
System Description: Ubuntu 20.04.6 LTS

--0000000000008befcb05fe95dde6--