* bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications
@ 2011-01-26 6:25 Daniel Colascione
2011-01-30 21:44 ` Daniel Colascione
2016-02-26 6:24 ` Lars Ingebrigtsen
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Colascione @ 2011-01-26 6:25 UTC (permalink / raw)
To: 7916
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
struct foo {
foo() throw() {}
~foo() throw() {}
};
struct bar {
bar() throw();
~bar() throw();
}
struct qux {
qux();
~qux() {}
};
qux::qux<int>() {
}
bar::~bar() throw()
{}
[-- Attachment #2: condestruc.patch --]
[-- Type: text/plain, Size: 1817 bytes --]
=== modified file 'lisp/progmodes/cc-engine.el'
--- lisp/progmodes/cc-engine.el 2011-01-26 05:06:59 +0000
+++ lisp/progmodes/cc-engine.el 2011-01-26 05:41:17 +0000
@@ -6588,7 +6588,22 @@
(when (and (not got-suffix-after-parens)
(= paren-depth 0))
(setq got-suffix-after-parens (match-beginning 0)))
- (setq got-suffix t)))
+ (setq got-suffix t)
+
+ (when (and (not got-identifier)
+ (not got-prefix)
+ c-recognize-typeless-decls
+ c-always-postfix-suffixes
+ (progn (goto-char (match-beginning 1))
+ (save-match-data
+ (looking-at c-always-postfix-suffixes))))
+ ;; "throw" and other keywords can only appear
+ ;; after an identifier in a declaration. If we
+ ;; see it and we've seen a type, the type is
+ ;; really the identifier.
+ (c-fdoc-shift-type-backward))
+
+ t))
;; No suffix matched. We might have matched the
;; identifier as a type and the open paren of a
=== modified file 'lisp/progmodes/cc-langs.el'
--- lisp/progmodes/cc-langs.el 2011-01-25 09:33:59 +0000
+++ lisp/progmodes/cc-langs.el 2011-01-26 05:41:17 +0000
@@ -4023,6 +4023,15 @@
(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
'dont-doc)
+(c-lang-defconst c-always-postfix-suffixes
+ "List of words that can appear only after the identifier in a
+ declarator --- e.g., \"throw\" for a C++ exception specification."
+ t nil
+ c++ '("throw" "sealed" "override"))
+(c-lang-defvar c-always-postfix-suffixes
+ (concat
+ (regexp-opt (c-lang-const c-always-postfix-suffixes c++)) "\\>"))
+
(c-lang-defconst c-after-suffixed-type-decl-key
"This regexp is matched after a declarator expression where
`c-type-decl-suffix-key' has matched. If it matches then the
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications
2011-01-26 6:25 bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications Daniel Colascione
@ 2011-01-30 21:44 ` Daniel Colascione
2016-02-26 6:24 ` Lars Ingebrigtsen
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Colascione @ 2011-01-30 21:44 UTC (permalink / raw)
To: bug-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Updated patch attached. The previous version choked on
lambda-expressions because I didn't take into account the side effects
of a test.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
iEYEARECAAYFAk1F26gACgkQ17c2LVA10VvNYgCgsMDhZ4pEQn7GFdfTKk/H3THx
nFUAoIk1QCxaiokX3Ol25Vhj05Q7Vl4x
=mp5G
-----END PGP SIGNATURE-----
[-- Attachment #2: construc-destruc-2.patch --]
[-- Type: text/plain, Size: 1830 bytes --]
=== modified file 'lisp/progmodes/cc-engine.el'
--- lisp/progmodes/cc-engine.el 2011-01-25 04:08:28 +0000
+++ lisp/progmodes/cc-engine.el 2011-01-30 21:40:16 +0000
@@ -6483,7 +6483,23 @@
(when (and (not got-suffix-after-parens)
(= paren-depth 0))
(setq got-suffix-after-parens (match-beginning 0)))
- (setq got-suffix t)))
+ (setq got-suffix t)
+
+ (when (and (not got-identifier)
+ (not got-prefix)
+ c-recognize-typeless-decls
+ c-always-postfix-suffixes
+ (save-excursion
+ (goto-char (match-beginning 1))
+ (save-match-data
+ (looking-at c-always-postfix-suffixes))))
+ ;; "throw" and other keywords can only appear
+ ;; after an identifier in a declaration. If we
+ ;; see it and we've seen a type, the type is
+ ;; really the identifier.
+ (c-fdoc-shift-type-backward))
+
+ t))
;; No suffix matched. We might have matched the
;; identifier as a type and the open paren of a
=== modified file 'lisp/progmodes/cc-langs.el'
--- lisp/progmodes/cc-langs.el 2011-01-26 08:36:39 +0000
+++ lisp/progmodes/cc-langs.el 2011-01-30 21:40:16 +0000
@@ -2721,6 +2721,15 @@
(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
'dont-doc)
+(c-lang-defconst c-always-postfix-suffixes
+ "List of words that can appear only after the identifier in a
+ declarator --- e.g., \"throw\" for a C++ exception specification."
+ t nil
+ c++ '("throw" "sealed" "override"))
+(c-lang-defvar c-always-postfix-suffixes
+ (concat
+ (regexp-opt (c-lang-const c-always-postfix-suffixes c++)) "\\>"))
+
(c-lang-defconst c-after-suffixed-type-decl-key
"This regexp is matched after a declarator expression where
`c-type-decl-suffix-key' has matched. If it matches then the
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications
2011-01-26 6:25 bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications Daniel Colascione
2011-01-30 21:44 ` Daniel Colascione
@ 2016-02-26 6:24 ` Lars Ingebrigtsen
2019-06-27 16:36 ` Lars Ingebrigtsen
1 sibling, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-26 6:24 UTC (permalink / raw)
To: Daniel Colascione; +Cc: 7916
Daniel Colascione <dan.colascione@gmail.com> writes:
> struct foo {
> foo() throw() {}
> ~foo() throw() {}
> };
>
> struct bar {
> bar() throw();
> ~bar() throw();
> }
>
> struct qux {
> qux();
> ~qux() {}
> };
>
> qux::qux<int>() {
>
> }
>
> bar::~bar() throw()
> {}
This seems to be working OK on the Emacs trunk, I think. Although I'm
not quite sure what I should be looking for.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications
2016-02-26 6:24 ` Lars Ingebrigtsen
@ 2019-06-27 16:36 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-27 16:36 UTC (permalink / raw)
To: Daniel Colascione; +Cc: 7916
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Daniel Colascione <dan.colascione@gmail.com> writes:
>
>> struct foo {
>> foo() throw() {}
>> ~foo() throw() {}
>> };
>>
>> struct bar {
>> bar() throw();
>> ~bar() throw();
>> }
>>
>> struct qux {
>> qux();
>> ~qux() {}
>> };
>>
>> qux::qux<int>() {
>>
>> }
>>
>> bar::~bar() throw()
>> {}
>
> This seems to be working OK on the Emacs trunk, I think. Although I'm
> not quite sure what I should be looking for.
There was no response three years ago, and putting that in a .cc file
and loading it, I can't see anything particularly wrong, so I'm closing
this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-27 16:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26 6:25 bug#7916: [PATCH] cc-mode does not fontify constructors and destructors with exception specifications Daniel Colascione
2011-01-30 21:44 ` Daniel Colascione
2016-02-26 6:24 ` Lars Ingebrigtsen
2019-06-27 16:36 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).