all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.