From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 29 02:08:36 2022 Received: (at submit) by debbugs.gnu.org; 29 Nov 2022 07:08:36 +0000 Received: from localhost ([127.0.0.1]:53838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozujM-0004x9-7o for submit@debbugs.gnu.org; Tue, 29 Nov 2022 02:08:36 -0500 Received: from lists.gnu.org ([209.51.188.17]:49326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozujK-0004x3-Fx for submit@debbugs.gnu.org; Tue, 29 Nov 2022 02:08:34 -0500 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 1ozujJ-0006zF-Bw for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 02:08:33 -0500 Received: from sonic306-20.consmr.mail.ne1.yahoo.com ([66.163.189.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozujG-0005cJ-Nm for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 02:08:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1669705705; bh=BUzDBfSYdRpQT4DWQ12Zt9C0C46S1zNjliP7KDjIEFc=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=o7nZKambwPkC8VnMr4Iu+mQT89hZ3+iv0beSQP+Si2DhYFcKJp3nPgmKqhEABPadbthz89kf6qjqGcdMy6NAlVKOu6W6OYjzSrvLpB+v907w9gQYkUdyqmwKcNoxodlCNt7R0BqyEJ/sPZJdgaV8pW3oVCCPUeyIk2iOtR+BSWgYm5MiE8hV8ZtY3+kezipdZ1PNLUM6+BARqhSi9wC1v7EckKkkax3N2oe6shyaY3hNGf8T5r36Ere3Bxf65GzZCjLbl4f3rTt2yIntk6BpsyWAhs7V/DTn0D4m1sWmYU+xt669RfMMrCRJ6vh/VWmbJvZloxpKgQV8YH42FwcZIQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1669705705; bh=zc5TYMWrHrbZKngeZIQdBF7G8vUk8QvDYszJXbqVfTO=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=L7kNxWLPkq0LmnpHMjvgQBdYUX5F//fxP21DH3mqXd81Yh+FOWyBv6zDTiMmZ9VwjNGrsKCiyzgebp0sGUbGt3T0ibRJVf6rVhF59Nn5OVYJw0rsRu44YEd87LrPQKE4RZEuVawycC7ItSa3MvObTJsRhUVttP2dxrl4l4RpLHxtXa1jO1wQjWHEHyrc8XlRDmSMPCql6Hsxah0vZq7dB6NmEtfDYtAIOTU4tzyv1DUDlhjNDIoeabevCWLniA0nKtu+XaIyBFFCMz0XN5mbcWWoiVdzAjER92koOQJMmhTCUx9r6rhTB9PX/rsigZmqmAohKmG5/wPao7vVjJlq+w== X-YMail-OSG: Lrh7MDoVM1lv1bz5PhaW7fzpWbyGmJdIcjOjxeaQiNC46Osf2AKG2B9tpVLXAMV EbxLctP.WaBVPSLHPorRDybnfdC5jOh7_Bd7gnLFT5Lxd9HxyPQYm4uQKprAzugzJL88WK_gOxRR KKAn9c2P8WBeeb0ucw7.82t4Sqe6uNpOQJV6wf5Df4GlDrS2R.Zw792rfs.Gg9vfYfXH8tJn1pvk yWWdENxlso8.AE7NYpodxzg1i6nd7XxEmx4nKAOOF98lpQrU4VOFSv1I0TeUzN56wz7FO41FYYuW kGJmdJ7jtObIk8hRwiih9AgCMV27c1eqhidmI4k4qXeMri2PES5pm9ENoy67sRuP_ZMZyVohK58W jLqNoOnRHnKhQP4sMaDh1rYkxnWwc8DlWSOGDDb8IrQY7uTWxDLnn9_2TjT9j1X6WwtUBeJ0oYOX OVtmgE_TYCg9YZSizXNeYSc2ZiI266i_oP7dnCLIa96y7B.NWYCec2X04WejXTGSVvyd3nk_4lku b10ikrqWnTkI9Q54kljloRuLMDoBIQwFUVyFqOqTduyT2k_rZItha_b7qPQAaw6J_WSfKGVik3kA WW3ULQHzk720aDiw2vt8mG.udjJj.hLI7kB_njy5yammUPPDnTdzG0G8fVsQzC02fkyD9JTPeG5T JMgs8XTJs7oLPe0tElxo_Ej04LYM75JMuU7J77RqRFX.fguPRDSVtv42zzM_O1TkFnM.Eb3nMkeh p.fhNylqQYvr_DGUWpILAZLVBOXW8so1iGGdKrBD7gH3uNzxFvOk92RvjeNhfcvSzEWWw_g_NrzV jHXOrJbb_w1fX2ogrcJw6UNsDJGWyZPbe4HBd54RwswyNHjEigks7nzVfD6E6i.Z2N3SutWa68GK ZkPKmNr6mkbc03iBMQnHprFFcsmrvWgrU1jwEPAqgTdtoZ6OrHVo2dFG1VdVtuvc1flKpkkqaBNn oWYuRnSeIa.Do7TvZl7TAoTG36uFMuR8hez8ipecMieOt4jRsAx7Ypt1KcCjkjS6waeUf66QbnhD ahPpJ2WPR8ckQYpRCP8oyaCZfNZ7s.PxaTMS4STNBxqOJuELZINAO691uhLJU5Jnu040lFcW6nFn 860T_sC.sHxE3z1xz6DhBReWWWK34BHd8eFGilEntGYvbtIQgFNLWyKyUjqY71xEDbr29K5..gxu 7VSctx26f7R5RJv9M2LZ0ZF8irYPB5LazVUc1vxBawiLgYd2j_BiMH_S.eEDG7G4mOI.IlDJhLsA JixP60hebUM0sLMs2NuT3smKXJleBPBkvRzkkZcStSR2j.UCZLDUK2801cxI5JTQf2rcqpUnvECo E14ITgem8OtsT82BVFnHPdDQRY7DovmFhiunJjXDFhvcSfkKEx5tLbsT3eul6PJnfvEgn77XM0S. k_I1aPSrbhal0MOV6ZbN.lTPIZkIBuyGhqgq4HGL_7EuftEvjMxCpck1I1Q8VO1Kj6DoRMQ9hrc4 FjzZo0EXnBb12NZ.uHvvIC.7FchSoNzmf5dXqmOx_deWRD3olVvOSN6lqlY2mvlGS9lgUMf1xdvO 6cdN4JQWZsyRVj65zFUn4PrECS_JymzkIV_4s.k9uMpyqmXHgGMcQ331CJ5FTgzmM7BhDCt.GhNi GEqHWqpQIyIlZVdn.Q3aZzcIYlJ3Hrkpt.BeCs4cH_hgbsXHCbD8kiIKK0pOS1rbteagj.lttN6F Zt04TTV4wIdPUX0PS3DPcakrECy_GCjErnXzWU1OaSXbn7cFGzMUW5_dFNyUgIK4t_1CtLms0DLZ 59V2dBUtUpfOxCl6ucrzbjxv3F80NZ3Ec.x0DdZv1Sa7ztKBGZx__dj2AFdt58r68VjhxHVuLww6 1CKVxodAKT.EMmb9g2naMvqN2DLp1eCHvYxfPAahaBe0Pg9J16AxgjNHKKYSZDAZygr3BOKWhXlF 2WOUPPJjKjM0L4Sr2iic0pxwWtwqx1KyHqrplYVbppytMQ4Go2AcPVifnfubeZNe53X9ol623.yF ipVy3JAxDyjgS_PCywxle3T7r6TAIbcwe275S_lz1ednoBI4XrRfzqGyLaQg6cM8d0eowTN7fWm4 WoQsqnZYaRi6BG7Hm9lMMBVXlZ5hUmESCq0NmAc94bndu_qQKXO6tWXAMikODBS8h.k15Dlz95vi aH_emHlI4Achjxt42KU.EJ8QK35a1r7vXX9oPmORnoFlzvD1yMgO1TglNsV2HpOm7I9yQJrQmytc 7CqM29NPuMGSpYOJFDXRkFSdTwiwSgqVl6Eadovr6ENIFG170LgjRCmQ- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Tue, 29 Nov 2022 07:08:25 +0000 Received: by hermes--production-sg3-6c8895b545-fzfcs (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID d99c9bd40b70883a9c074ba52e7a4353; Tue, 29 Nov 2022 07:08:21 +0000 (UTC) From: Po Lu To: bug-gnu-emacs@gnu.org Subject: CC Mode 5.35.2 (C/*l); More incorrect type recognition X-Debbugs-Package: cc-mode Date: Tue, 29 Nov 2022 15:08:15 +0800 Message-ID: <87tu2iutk0.fsf@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable References: <87tu2iutk0.fsf.ref@yahoo.com> X-Mailer: WebService/1.1.20863 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 4943 Received-SPF: pass client-ip=66.163.189.82; envelope-from=luangruo@yahoo.com; helo=sonic306-20.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.6 (-) Package: cc-mode Insert the following code in a buffer: /* fns.c -- generic utility functions. */ /* Allocate a scratch buffer with the given size. The buffer must be used before the next call to allocscratch. */ static void * allocscratch (size_t size) { } now, on the line below the first comment, type: typedef struct foo then pause for a second, and type: bar; c-found-types will then contain "allocscratch"!. Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu) of 2022-11-29 Package: CC Mode 5.35.2 (C/*l) Buffer Style: gnu c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-st= ring-delim gen-comment-delim syntax-properties category-properties 1-bit) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq c-basic-offset 2 c-comment-only-line-offset '(0 . 0) c-indent-comment-alist '((anchored-comment column . 0) (end-block space . = 1) (cpp-end-block space . 2)) c-indent-comments-syntactically-p nil c-block-comment-prefix "" c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "#+") (other . "//+\\|\\**")) c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc) (c++-mode . gtkdoc)) c-cleanup-list '(scope-operator) c-hanging-braces-alist '((substatement-open before after) (arglist-cont-nonempty)) c-hanging-colons-alist nil c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) c-backslash-column 48 c-backslash-max-column 72 c-special-indent-hook '(t c-gnu-impose-minimum) c-label-minimum-indentation 1 c-offsets-alist '((inexpr-class . +) (inexpr-statement . +) (lambda-intro-cont . +) (inlambda . 0) (template-args-cont c-lineup-template-args +) (incomposition . +) (inmodule . +) (innamespace . +) (inextern-lang . +) (composition-close . 0) (module-close . 0) (namespace-close . 0) (extern-lang-close . 0) (composition-open . 0) (module-open . 0) (namespace-open . 0) (extern-lang-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call + ) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (friend . 0) (cpp-define-intro c-lineup-cpp-define +) (cpp-macro-cont . +) (cpp-macro . [0]) (inclass . +) (stream-op . c-lineup-streamop) (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist ) (arglist-cont c-lineup-gcc-asm-reg 0) (comment-intro c-lineup-knr-region-comment c-lineup-comment ) (catch-clause . 0) (else-clause . 0) (do-while-closure . 0) (access-label . -) (case-label . 0) (substatement . +) (statement-case-intro . +) (statement . 0) (brace-entry-open . 0) (brace-list-entry . 0) (brace-list-close . 0) (block-close . 0) (block-open . 0) (inher-cont . c-lineup-multi-inher) (inher-intro . +) (member-init-cont . c-lineup-multi-inher) (member-init-intro . +) (annotation-var-cont . +) (annotation-top-cont . 0) (topmost-intro . 0) (knr-argdecl . 0) (func-decl-cont . +) (inline-close . 0) (class-close . 0) (class-open . 0) (defun-block-intro . +) (defun-close . 0) (defun-open . 0) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (topmost-intro-cont first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont ) (brace-list-intro first c-lineup-2nd-brace-entry-in-arglist c-lineup-class-decl-init-+ + ) (brace-list-open . +) (inline-open . 0) (arglist-close . c-lineup-arglist) (arglist-intro . c-lineup-arglist-intro-after-paren) (statement-cont . +) (statement-case-open . +) (label . 0) (substatement-label . 0) (substatement-open . +) (knr-argdecl-intro . 5) (statement-block-intro . +) ) c-buffer-is-cc-mode 'c-mode c-tab-always-indent t c-syntactic-indentation t c-syntactic-indentation-in-macros t c-ignore-auto-fill '(string cpp code) c-auto-align-backslashes t c-backspace-function 'backward-delete-char-untabify c-delete-function 'delete-char c-electric-pound-behavior nil c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "gnu")) c-enable-xemacs-performance-kludge-p nil c-old-style-variable-behavior nil defun-prompt-regexp nil tab-width 8 comment-column 32 parse-sexp-ignore-comments t parse-sexp-lookup-properties t auto-fill-function nil comment-multi-line t comment-start-skip "\\(?://+\\|/\\*+\\)\\s *" fill-prefix nil fill-column 70 paragraph-start "[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f" adaptive-fill-mode t adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2=80=93!|#%= ;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)" ) From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 14:00:16 2022 Received: (at 59671) by debbugs.gnu.org; 8 Dec 2022 19:00:16 +0000 Received: from localhost ([127.0.0.1]:58455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3M7z-0002PI-5h for submit@debbugs.gnu.org; Thu, 08 Dec 2022 14:00:16 -0500 Received: from mx3.muc.de ([193.149.48.5]:49846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3M7w-0002O5-0j for 59671@debbugs.gnu.org; Thu, 08 Dec 2022 14:00:13 -0500 Received: (qmail 86106 invoked by uid 3782); 8 Dec 2022 20:00:05 +0100 Received: from acm.muc.de (p4fe15860.dip0.t-ipconnect.de [79.225.88.96]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 08 Dec 2022 20:00:04 +0100 Received: (qmail 31140 invoked by uid 1000); 8 Dec 2022 19:00:04 -0000 Date: Thu, 8 Dec 2022 19:00:04 +0000 To: Po Lu Subject: Re: bug#59671: CC Mode 5.35.2 (C/*l); More incorrect type recognition Message-ID: References: <87tu2iutk0.fsf.ref@yahoo.com> <87tu2iutk0.fsf@yahoo.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="/281ySegA2VPkgt5" Content-Disposition: inline In-Reply-To: <87tu2iutk0.fsf@yahoo.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59671 Cc: 59671@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --/281ySegA2VPkgt5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, Po. On Tue, Nov 29, 2022 at 15:08:15 +0800, Po Lu via CC-Mode-help wrote: > Package: cc-mode > Insert the following code in a buffer: > /* fns.c -- generic utility functions. */ > /* Allocate a scratch buffer with the given size. The buffer must be > used before the next call to allocscratch. */ > static void * > allocscratch (size_t size) > { > } > now, on the line below the first comment, type: > typedef struct foo > then pause for a second, and type: > bar; > c-found-types will then contain "allocscratch"!. Yes. This is not good. Please try out the attached patch which applies cleanly to the release branch (and almost certainly to the master branch too). This should fix the problem, in that although "allocscratch" gets entered into c-found-types, it gets removed again as soon as a type and declarator are typed in after the typedef. > Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu) > of 2022-11-29 > Package: CC Mode 5.35.2 (C/*l) > Buffer Style: gnu > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties category-properties 1-bit) [ .... ] -- Alan Mackenzie (Nuremberg, Germany). --/281ySegA2VPkgt5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="diff.20221208.diff" diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index b13f6a5914..759620c533 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1361,6 +1361,28 @@ c-search-forward-char-property (search-forward-regexp "\\(\n\\|.\\)") ; to set the match-data. (point)))) +(defmacro c-search-forward-non-nil-char-property (property &optional limit) + "Search forward for a text-property PROPERTY value non-nil. +LIMIT bounds the search. The comparison is done with `equal'. + +Leave point just after the character. The match data remain +unchanged. Return the value of PROPERTY. If a non-nil value +isn't found, return nil; point is then left undefined." + (declare (debug t)) + `(let* ((-limit- (or ,limit (point-max))) + (value (c-get-char-property (point) ,property))) + (cond + ((>= (point) -limit-) + nil) + (value + (forward-char) + value) + (t (let ((place (c-next-single-property-change + (point) ,property nil -limit-))) + (when place + (goto-char (1+ place)) + (c-get-char-property place ,property))))))) + (defmacro c-search-backward-char-property (property value &optional limit) "Search backward for a text-property PROPERTY having value VALUE. LIMIT bounds the search. The comparison is done with `equal'. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index edb873f5a6..115fcfa20a 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -142,6 +142,10 @@ ;; Put on the brace which introduces a brace list and on the commas ;; which separate the elements within it. ;; +;; 'c-typedef This property is applied to the first character of a +;; "typedef" keyword. It's value is a list of the identifiers that +;; the "typedef" declares as types. +;; ;; 'c-<>-c-types-set ;; This property is set on an opening angle bracket, and indicates that ;; any "," separators within the template/generic expression have been @@ -10024,10 +10028,10 @@ c-fdoc-shift-type-backward ;; an identifier instead. (declare (debug nil)) `(progn + (setq identifier-start type-start) ,(unless short ;; These identifiers are bound only in the inner let. '(setq identifier-type at-type - identifier-start type-start got-parens nil got-identifier t got-suffix t @@ -10102,10 +10106,11 @@ c-forward-decl-or-cast-1 ;; The second element of the return value is non-nil when something ;; indicating the identifier is a type occurs in the declaration. ;; Specifically it is nil, or a three element list (A B C) where C is t - ;; when context is '<> and the "identifier" is a found type, B is t when a - ;; `c-typedef-kwds' ("typedef") is present, and A is t when some other - ;; `c-typedef-decl-kwds' (e.g. class, struct, enum) specifier is present. - ;; I.e., (some of) the declared identifier(s) are types. + ;; when context is '<> and the "identifier" is a found type, B is the + ;; position of the `c-typedef-kwds' keyword ("typedef") when such is + ;; present, and A is t when some other `c-typedef-decl-kwds' (e.g. class, + ;; struct, enum) specifier is present. I.e., (some of) the declared + ;; identifier(s) are types. ;; ;; The third element of the return value is non-nil when the declaration ;; parsed might be an expression. The fourth element is the position of @@ -10173,6 +10178,9 @@ c-forward-decl-or-cast-1 ;; `c-decl-hangon-kwds' and their associated clauses that ;; occurs after the type. id-start + ;; The earlier value of `type-start' if we've shifted the type + ;; backwards. + identifier-start ;; These store `at-type', `type-start' and `id-start' of the ;; identifier before the one in those variables. The previous ;; identifier might turn out to be the real type in a @@ -10183,7 +10191,8 @@ c-forward-decl-or-cast-1 ;; Set if we've found a specifier (apart from "typedef") that makes ;; the defined identifier(s) types. at-type-decl - ;; Set if we've a "typedef" keyword. + ;; If we've a "typedef" keyword (?or similar), the buffer position of + ;; its first character. at-typedef ;; Set if `context' is '<> and the identifier is definitely a type, or ;; has already been recorded as a found type. @@ -10266,7 +10275,7 @@ c-forward-decl-or-cast-1 (looking-at "@[A-Za-z0-9]+"))) (save-match-data (if (looking-at c-typedef-key) - (setq at-typedef t))) + (setq at-typedef (point)))) (setq kwd-sym (c-keyword-sym (match-string 1))) (save-excursion (c-forward-keyword-clause 1) @@ -10486,9 +10495,9 @@ c-forward-decl-or-cast-1 ;; True if we've parsed the type decl to a token that is ;; known to end declarations in this context. at-decl-end - ;; The earlier values of `at-type' and `type-start' if we've - ;; shifted the type backwards. - identifier-type identifier-start + ;; The earlier value of `at-type' if we've shifted the type + ;; backwards. + identifier-type ;; If `c-parse-and-markup-<>-arglists' is set we need to ;; turn it off during the name skipping below to avoid ;; getting `c-type' properties that might be bogus. That @@ -10530,6 +10539,10 @@ c-forward-decl-or-cast-1 (progn (setq got-identifier nil) t) ;; It turned out to be the real identifier, ;; so stop. + (save-excursion + (c-backward-syntactic-ws) + (c-simple-skip-symbol-backward) + (setq identifier-start (point))) nil)) t)) @@ -10555,6 +10568,10 @@ c-forward-decl-or-cast-1 (and (looking-at c-identifier-start) (setq pos (point)) (setq got-identifier (c-forward-name)) + (save-excursion + (c-backward-syntactic-ws) + (c-simple-skip-symbol-backward) + (setq identifier-start (point))) (setq name-start pos)) (when (looking-at "[0-9]") (setq got-number t)) ; We probably have an arithmetic expression. @@ -10573,7 +10590,8 @@ c-forward-decl-or-cast-1 (setq at-type nil name-start type-start id-start type-start - got-identifier t))) + got-identifier t) + (setq identifier-start type-start))) ;; Skip over type decl suffix operators and trailing noise macros. (while diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 9444828a0e..13eba2b3f6 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1109,10 +1109,12 @@ c-font-lock-declarators ;; additionally, mark the commas with c-type property 'c-decl-id-start or ;; 'c-decl-type-start (according to TYPES). Stop at LIMIT. ;; - ;; If TYPES is t, fontify all identifiers as types, if it is nil fontify as - ;; either variables or functions, otherwise TYPES is a face to use. If - ;; NOT-TOP is non-nil, we are not at the top-level ("top-level" includes - ;; being directly inside a class or namespace, etc.). + ;; If TYPES is t, fontify all identifiers as types; if it is a number, a + ;; buffer position, additionally set the `c-deftype' text property on the + ;; keyword at that position; if it is nil fontify as either variables or + ;; functions, otherwise TYPES is a face to use. If NOT-TOP is non-nil, we + ;; are not at the top-level ("top-level" includes being directly inside a + ;; class or namespace, etc.). ;; ;; TEMPLATE-CLASS is non-nil when the declaration is in template delimiters ;; and was introduced by, e.g. "typename" or "class", such that if there is @@ -1129,17 +1131,28 @@ c-font-lock-declarators ;;(message "c-font-lock-declarators from %s to %s" (point) limit) (c-fontify-types-and-refs () + ;; If we're altering the declarators in a typedef, we need to scan ALL of + ;; them because of the way we check for changes. + (let ((c-do-decl-limit (if (numberp types) (point-max) limit)) + decl-ids) (c-do-declarators - limit list not-top - (cond ((eq types t) 'c-decl-type-start) + c-do-decl-limit + list not-top + (cond ((or (numberp types) + (eq types t)) + 'c-decl-type-start) ((null types) 'c-decl-id-start)) (lambda (id-start id-end end-pos _not-top is-function init-char) - (if (eq types t) + (if (or (numberp types) + (eq types t)) (when id-start ;; Register and fontify the identifier as a type. (let ((c-promote-possible-types t)) (goto-char id-start) - (c-forward-type))) + (c-forward-type)) + (when (numberp types) + (push (buffer-substring-no-properties id-start id-end) + decl-ids))) (when id-start (goto-char id-start) (when c-opt-identifier-prefix-key @@ -1147,7 +1160,7 @@ c-font-lock-declarators (eq (match-end 1) id-end)) (while (and (< (point) id-end) (re-search-forward c-opt-identifier-prefix-key id-end t)) - (c-forward-syntactic-ws limit)))) + (c-forward-syntactic-ws c-do-decl-limit)))) ;; Only apply the face when the text doesn't have one yet. ;; Exception: The "" in C++'s operator"" will already wrongly have ;; string face. @@ -1164,7 +1177,7 @@ c-font-lock-declarators (equal (buffer-substring-no-properties id-start id-end) "\"\"")) (goto-char id-end) - (c-forward-syntactic-ws limit) + (c-forward-syntactic-ws c-do-decl-limit) (when (c-on-identifier) (c-put-font-lock-face (point) @@ -1174,10 +1187,21 @@ c-font-lock-declarators (eq init-char ?=) ; C++ ""? (progn (goto-char end-pos) - (c-forward-token-2 1 nil limit) ; Over "=" + (c-forward-token-2 1 nil c-do-decl-limit) ; Over "=" (let ((c-promote-possible-types t)) (c-forward-type t))))) accept-anon) ; Last argument to c-do-declarators. + ;; If we've changed types declared by a "typedef", update the `c-typedef' + ;; text property. + (when (numberp types) + (let* ((old-decl-ids (c-get-char-property types 'c-typedef)) + (old-types (c--set-difference old-decl-ids decl-ids :test #'equal)) + (new-types (c--set-difference decl-ids old-decl-ids :test #'equal))) + (dolist (type old-types) + (c-unfind-type type)) + ;; The new types have already been added to `c-found-types', as needed. + (when (or old-types new-types) + (c-put-char-property types 'c-typedef decl-ids))))) nil)) (defun c-get-fontification-context (match-pos not-front-decl &optional toplev) @@ -1433,7 +1457,10 @@ c-font-lock-single-decl (c-font-lock-declarators (min limit (point-max)) decl-list - (not (null (cadr decl-or-cast))) + (cond ((null (cadr decl-or-cast)) + nil) + ((cadr (cadr decl-or-cast))) + (t t)) (not toplev) template-class (memq context '(decl <>)))) @@ -1730,6 +1757,40 @@ c-font-lock-enum-tail (c-font-lock-declarators limit t nil t)))) nil) +(defun c-font-lock-enclosing-decls (limit) + ;; Fontify the declarators of (nested) declarations we're in the middle of. + ;; This is mainly for when a jit-lock etc. chunk starts inside the brace + ;; block of a struct/union/class, etc. + ;; + ;; This function will be called from font-lock for a region bounded by POINT + ;; and LIMIT, as though it were to identify a keyword for + ;; font-lock-keyword-face. It always returns NIL to inhibit this and + ;; prevent a repeat invocation. See elisp/lispref page "Search-based + ;; Fontification". + (c-skip-comments-and-strings limit) + (when (< (point) limit) + (let* ((paren-state (c-parse-state)) + (decl-search-lim (c-determine-limit 1000)) + in-typedef ps-elt) + ;; Are we in any nested struct/union/class/etc. braces? + (while paren-state + (setq ps-elt (car paren-state) + paren-state (cdr paren-state)) + (when (and (atom ps-elt) + (eq (char-after ps-elt) ?\{)) + (goto-char ps-elt) + (c-syntactic-skip-backward "^;{}" decl-search-lim) + (c-forward-syntactic-ws) + (setq in-typedef (looking-at c-typedef-key)) + (if in-typedef (c-forward-over-token-and-ws)) + (when (and c-opt-block-decls-with-vars-key + (looking-at c-opt-block-decls-with-vars-key)) + (goto-char ps-elt) + (when (c-safe (c-forward-sexp)) + (c-forward-syntactic-ws) + (c-font-lock-declarators limit t in-typedef + (not (c-bs-at-toplevel-p (point))))))))))) + (defun c-font-lock-cut-off-declarators (limit) ;; Fontify any declarators "cut off" from their declaring type at the start ;; of the region being fontified. @@ -1749,12 +1810,21 @@ c-font-lock-cut-off-declarators ; speeds up lisp.h tremendously. (save-excursion (when (not (c-back-over-member-initializers decl-search-lim)) + (setq paren-state (c-parse-state)) (unless (or (eobp) (looking-at "\\s(\\|\\s)")) (forward-char)) (c-syntactic-skip-backward "^;{}" decl-search-lim t) - (when (eq (char-before) ?}) - (c-go-list-backward) ; brace block of struct, etc.? + ;; Do we have the brace block of a struct, etc.? + (when (cond + ((and (consp (car paren-state)) + (eq (char-before) ?})) + (goto-char (caar paren-state)) + t) + ((and (numberp (car paren-state)) + (eq (char-after (car paren-state)) ?{)) + (goto-char (car paren-state)) + t)) (c-syntactic-skip-backward "^;{}" decl-search-lim t)) (when (or (bobp) (memq (char-before) '(?\; ?{ ?}))) @@ -1782,40 +1852,6 @@ c-font-lock-cut-off-declarators context top-level)))))))) nil))) -(defun c-font-lock-enclosing-decls (limit) - ;; Fontify the declarators of (nested) declarations we're in the middle of. - ;; This is mainly for when a jit-lock etc. chunk starts inside the brace - ;; block of a struct/union/class, etc. - ;; - ;; This function will be called from font-lock for a region bounded by POINT - ;; and LIMIT, as though it were to identify a keyword for - ;; font-lock-keyword-face. It always returns NIL to inhibit this and - ;; prevent a repeat invocation. See elisp/lispref page "Search-based - ;; Fontification". - (c-skip-comments-and-strings limit) - (when (< (point) limit) - (let* ((paren-state (c-parse-state)) - (decl-search-lim (c-determine-limit 1000)) - in-typedef ps-elt) - ;; Are we in any nested struct/union/class/etc. braces? - (while paren-state - (setq ps-elt (car paren-state) - paren-state (cdr paren-state)) - (when (and (atom ps-elt) - (eq (char-after ps-elt) ?\{)) - (goto-char ps-elt) - (c-syntactic-skip-backward "^;{}" decl-search-lim) - (c-forward-syntactic-ws) - (setq in-typedef (looking-at c-typedef-key)) - (if in-typedef (c-forward-over-token-and-ws)) - (when (and c-opt-block-decls-with-vars-key - (looking-at c-opt-block-decls-with-vars-key)) - (goto-char ps-elt) - (when (c-safe (c-forward-sexp)) - (c-forward-syntactic-ws) - (c-font-lock-declarators limit t in-typedef - (not (c-bs-at-toplevel-p (point))))))))))) - (defun c-font-lock-ml-strings (limit) ;; Fontify multi-line strings. ;; diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 6a2c2f2911..74b493d24a 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2077,6 +2077,37 @@ c-after-change-fix-comment-escapes (not (eobp)))) (forward-char)))))) +(defun c-before-change-de-typedef (beg end) + ;; For each "typedef" starting in (BEG END), remove the defined types from + ;; c-found-types + (let (prop) + (save-excursion + (goto-char beg) + (while (and (< (point) end) + (setq prop (c-search-forward-non-nil-char-property + 'c-typedef))) + (dolist (type prop) + (c-unfind-type type)))))) + +(defun c-after-change-de-typedef (beg end _old-len) + ;; For each former "typedef" in (BEG END), remove the defined types from + ;; those which are no longer typedefs. + (let (prop) + (save-excursion + (goto-char beg) + (c-backward-token-2 + 1 nil (- (point) 20)) + (while (and (< (point) end) + (setq prop (c-search-forward-non-nil-char-property + 'c-typedef end))) + (backward-char) + (when (or (not (looking-at c-typedef-key)) + (<= (match-end 1) beg)) + (dolist (type prop) + (c-unfind-type type)) + (c-clear-char-property (point) 'c-typedef)) + (forward-char))))) + (defun c-update-new-id (end) ;; Note the bounds of any identifier that END is in or just after, in ;; `c-new-id-start' and `c-new-id-end'. Otherwise set these variables to @@ -2215,6 +2246,10 @@ c-before-change term-pos) (buffer-substring-no-properties beg end))))))) + ;; If we're about to delete "typedef"s, clear the identifiers from + ;; `c-found-types'. + (c-before-change-de-typedef beg end) + (if c-get-state-before-change-functions (mapc (lambda (fn) (funcall fn beg end)) @@ -2304,11 +2339,11 @@ c-after-change (c-clear-char-property-with-value beg end 'syntax-table nil))) (c-update-new-id end) - (c-trim-found-types beg end old-len) ; maybe we don't - ; need all of these. + (c-trim-found-types beg end old-len) ; maybe we don't need all + ; of these. + (c-after-change-de-typedef beg end old-len) (c-invalidate-sws-region-after beg end old-len) - ;; (c-invalidate-state-cache beg) ; moved to - ;; `c-before-change'. + ;; (c-invalidate-state-cache beg) ; moved to `c-before-change'. (c-invalidate-find-decl-cache beg) (when c-recognize-<>-arglists --/281ySegA2VPkgt5-- From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 08 20:05:54 2022 Received: (at 59671) by debbugs.gnu.org; 9 Dec 2022 01:05:54 +0000 Received: from localhost ([127.0.0.1]:60190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Rpp-0008CG-PM for submit@debbugs.gnu.org; Thu, 08 Dec 2022 20:05:54 -0500 Received: from sonic313-10.consmr.mail.ne1.yahoo.com ([66.163.185.33]:42418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3Rpn-0008C7-76 for 59671@debbugs.gnu.org; Thu, 08 Dec 2022 20:05:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1670547945; bh=fGVlfB0tMm6JpukRVm/AImopu8r0PEvTBHa5QocmmPc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=iDARFiu6xWn4P1tumLCtdNfLG3Bv1AX/WwYwyN9rfMQZDl0qEfHp38kuJeaY1JFeEx/AoH9V68bJe4pv9bKP0iGZrM7vEsGsxVz/4LzY+hxEeFFUspV0QzNFBVaFukjlwAeq8Kn3el8fpjHTiR2ovEij+Y82DJ//dQo6uYur6BTKh62R6eP/qfOJiKK+MjEvW32jFibuxrwpB5/5vZpKcJbKLCamH6wnyfjXDearzF32RzT9BXq9OVcDLGomw772986CNZDTQ7IKSoimyLx+NX9x+cfIu4la6PA9OeBQBBCpqd7ley80P6lNjHyhJnJnyv4Ik4+CxPP7sAKH448PQA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1670547945; bh=Z3txuKlvHWryxBZvgnEtmQI58rPoeACC11BoQgtDo/0=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=RyHEz3Mnlv/p2mGOe2m76VLP9vQItQxBrAy9pEtLeHMLCJoOX0FHjGdEZ+NKP1y+czm9k/mEI5eR9AOKdTBobHLs81jVF/YiqNW0ggzUZYZskCNpp17j7EEq3+hfMWtIfk8fA1QJmOBmaWZ+iv/OX27XjXqoGCX/f83dWR/2xCw5uYSmkYClhNo1y9AjKze+ssJf3krfUi4WKTmiHFvUBXS+qZQu3khOKueCdIKllgRdQMDhDz7CaBUtkTEFLyyc71+80RxJbGE4M/FarI1QlRxDxkuTevZJeErdKow21wVO2wfkVw7qrwuwHZUOV1e4KfeMr8PlHvIzfQ++ZK2S4Q== X-YMail-OSG: qwrxof4VM1lefKOkWAC5hg4zRCAGZu6gYfOBWiZ8ne8jxoKC1YzaCL_g0iTY44I tYRzg_GcbznpqAezIwmB.h.0YYl88slUP21G5iF56V4Hj2ROM5z9dZI6oVJUmPieVsp8dAZ6VU6u c.Y9AmflDuavx5OstQVZLqhybe.oi6N6rmOM73uDwhaYH38pkl2DQ8AAA3kvtkxTdkMWrxolm3Nc MIf0MNT.6uvzWH.jxp6O89dy_MRKdoYRIkAzXlpGBQnuQCTyRiDFiCuoHqEbCRsRV3f62x9sCf1D oCK.PkBsGWNJG3t_zPm047IznHhklMs.kOMjAPSJfsCRoNcSFuh0h6sk5O_2ir5Y8IJrltwYsznx Z_gopWT1qj3T4ywCqULOZAZUdc5fxJwMRwkrSclV9.Q_GTANL7OJ_4WRJTDv_XS6yumoK1oBEuw9 s2CDGh_GuFTK59tIDEpS1HSFxzmbAIxh9yT0w6PIrs0_kDSrYsN1bMs_so5qy2PWN4DfI_HwVww6 R6ZPo54auNL4Qj5Ee5SmzymfIvAY8lQIfTXp3SVw.og59EZvoWOzmCufkHb.aV8ml2yTF0WmUlVo 0D0e_cBmDghAx_BI6AssqeH66azw_VPMOWDKahNyd.6TbpCL0st4RJ6_DvA7aeA_Ypb3hJiET2zO ivhakXjJOSAZwF7RUUbEKN2RlSkAFuoCmxK_oGb7a5xNKubSwYSPPup3x9YbPfXzB6MItBxipkW1 LsRrUb2.KkQfRFPKTmOGafLe.DhLQLGphscETAEjq0L64sQGGxaNNXofuCy2ulU6uUB.CfKC9Ewu APfTHzw4AMW5251Zm8WhYfe6qUdlHMD1vcp9uEHE0uTBqAG_MvbDCgVj0LzMJfrN8mpEguHafXcD w4H5vdkoLoORfgEqbvz_K9tiBiNnkhjQIZV.2aGHCsW1ZQiSXUyWl7ZZ2zYMyFq59xvVbxciEJll BBm3T6SxQ5Q4.znfoxwZ_ssmRm0yQyZlKtN3HVFpwAw4MKH8hWaplihB4lSm41I5kGKSI1McWbfb pLu55Y0jtsjxzmrYQQ.3LvGOcmjd9KLZKB2nJAzJ5mg4tGZZn9vCbgBwXr3eeyhDhWZxHV.XDgzu xLCPRaeLeWTRDSmUAYS5a2PqXs7DCOpROoAVmuSfGgHA7KDxkzTgsy5.3K7uC6Shjq9FeX1AxFGF fx7NPSulrVZ72REgcqrcZnruw2sVvPIbGPHswXF6V3bQZ5RYq_pigQp3kxe9SYeg.HH8OStUxaY7 8TW2D0FTErZ.ecfsCqdPNMslD3Y_LZtgsQgrypmqlKD1fbUSjIA3yapAE8i4OK_BaE2gG7oLuU3J 1o36iLZ9EmkoNWnDzNJQVJRaP15tUjKwogPrn86fQzn9yOMmK_GKUNYCMPkwb_NHSMrWy8aszFnh 2mzOWNpQgqQJKOX7TtlVYnjSid_ZMTBUQymumtlMPymMPSILHZN78Upt5Dqq2W6BWNq2kIbZc8m5 HU3qxldvpW8IAjKhH.gHov3sAMP7chp1_7FeBOgtI7jmnwaTnIjQoiprD4El7dXfq4bNhCvXAhUM WDbGihZ.61MFw2SGO5_ypsvjR7PE1QNAfo2o4.il20oN0WYM1Ofvaz_XkVlDLNi1lONto9Qu1zQ3 wUquahlAdXOQoSn4TO8qStnrTX1YRA1nNpaYdqWaHrsSLRF78IjbzJPb2Dz3PFGsmq0fi7kCYjBS kE0PE.RZutiYXNkH9ujFBkX9cwTJQd9i8zW9df990jPG.WW1QBIUoAFgHPbNvwYGXGp2LTJZMs7B kXK6ERyp4ZfcDlwlvFoaNW03S4TXeoEZ09ngwnQ9F4ol9nkMuDjF3R0dcKsj1ogg6vJCVDT7o_zx 4KhAPK.RT3UN95IaPivFrt64rcmgUrnQuJR0aQ5ZzQyr0gC1myqpQNnpHTu_pYX9dAD6fZ7U5m.H d9Ajx2dcUviPUDp4CdT4cQpsugZ7ekwJ3cEX034G9VA6WXCeBx2IHmVjfV59zmGYHwZ93CqWLgv7 kHvcve44adICEPlrJjkPPle2HksEftdN4kp4EFgB_8XfV91bfe1.Dvyw57Qw5q2Fg4D2zcmt4q.T vMLjqeirfeafrSTnUmbTow.a85sgl9zq0zucDyNuhzUQM9HdUvhKDcFqT1WsDxAp1LJA2yiPJikd HGKnvf3uX5osjUQp0JFcCnG2rv1UBlwdNso1dktbKQ2Fb56UrYP4en71jlj7YXXQW0HWVf.s7iT3 paOtcRg6DpbbMt6ZAQH0wlTto2Zhymc9EKsEBmA4dWmt9tyMxnougtle_2fwkqF4w X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Fri, 9 Dec 2022 01:05:45 +0000 Received: by hermes--production-sg3-b666c6484-nr67k (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID ce10f22e4566bfec8b95951f75c567b8; Fri, 09 Dec 2022 01:05:40 +0000 (UTC) From: Po Lu To: Alan Mackenzie Subject: Re: bug#59671: CC Mode 5.35.2 (C/*l); More incorrect type recognition In-Reply-To: (Alan Mackenzie's message of "Thu, 8 Dec 2022 19:00:04 +0000") References: <87tu2iutk0.fsf.ref@yahoo.com> <87tu2iutk0.fsf@yahoo.com> Date: Fri, 09 Dec 2022 09:05:35 +0800 Message-ID: <875yell734.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.20926 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 466 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59671 Cc: 59671@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alan Mackenzie writes: > Yes. This is not good. Please try out the attached patch which applies > cleanly to the release branch (and almost certainly to the master branch > too). This should fix the problem, in that although "allocscratch" gets > entered into c-found-types, it gets removed again as soon as a type and > declarator are typed in after the typedef. This works for my example but I've yet to use the patch in the real world. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 13:26:15 2023 Received: (at 59671-done) by debbugs.gnu.org; 17 Jan 2023 18:26:15 +0000 Received: from localhost ([127.0.0.1]:38228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHqf1-0006Ay-0g for submit@debbugs.gnu.org; Tue, 17 Jan 2023 13:26:15 -0500 Received: from mx3.muc.de ([193.149.48.5]:16093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHqew-0006Ai-Ge for 59671-done@debbugs.gnu.org; Tue, 17 Jan 2023 13:26:13 -0500 Received: (qmail 9407 invoked by uid 3782); 17 Jan 2023 19:26:04 +0100 Received: from acm.muc.de (p4fe15b99.dip0.t-ipconnect.de [79.225.91.153]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 17 Jan 2023 19:26:03 +0100 Received: (qmail 7374 invoked by uid 1000); 17 Jan 2023 18:26:03 -0000 Date: Tue, 17 Jan 2023 18:26:03 +0000 To: Po Lu Subject: Re: bug#59671: CC Mode 5.35.2 (C/*l); More incorrect type recognition Message-ID: References: <87tu2iutk0.fsf.ref@yahoo.com> <87tu2iutk0.fsf@yahoo.com> <875yell734.fsf@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875yell734.fsf@yahoo.com> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59671-done Cc: 59671-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Po. On Fri, Dec 09, 2022 at 09:05:35 +0800, Po Lu wrote: > Alan Mackenzie writes: > > Yes. This is not good. Please try out the attached patch which applies > > cleanly to the release branch (and almost certainly to the master branch > > too). This should fix the problem, in that although "allocscratch" gets > > entered into c-found-types, it gets removed again as soon as a type and > > declarator are typed in after the typedef. > This works for my example but I've yet to use the patch in the real > world. Thanks. I've committed the patch and I'm closing the bug with this post. -- Alan Mackenzie (Nuremberg, Germany). From unknown Fri Sep 19 23:03:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 15 Feb 2023 12:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator