]> code.delx.au - gnu-emacs/commitdiff
C++ Mode: attribute in class declaration fouls up indentation. Fix!
authorAlan Mackenzie <acm@muc.de>
Sat, 28 May 2016 15:17:28 +0000 (15:17 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 28 May 2016 15:17:28 +0000 (15:17 +0000)
* lisp/progmodes/cc-engine.el (c-looking-at-decl-block): Add code to skip
back over noise clauses and attribute clauses.

* lisp/progmodes/cc-langs.el (c-paren-nontype-key): New language variable.

lisp/progmodes/cc-engine.el
lisp/progmodes/cc-langs.el

index 2450a5db8b9cb8f7836f5b77e6b9bdb569943f2c..b9f25eeaee4808c52981e7e6a7e1b0514fc0a0a1 100644 (file)
@@ -8899,6 +8899,22 @@ comment at the start of cc-engine.el for more info."
                  (c-syntactic-skip-backward c-block-prefix-charset limit t)
                  (eq (char-before) ?>))))))
 
+    ;; Skip back over noise clauses.
+    (while (and
+           c-opt-cpp-prefix
+           (eq (char-before) ?\))
+           (let ((after-paren (point)))
+             (if (and (c-go-list-backward)
+                      (progn (c-backward-syntactic-ws)
+                             (c-simple-skip-symbol-backward))
+                      (or (looking-at c-paren-nontype-key)
+                          (looking-at c-noise-macro-with-parens-name-re)))
+                 (progn
+                   (c-syntactic-skip-backward c-block-prefix-charset limit t)
+                   t)
+               (goto-char after-paren)
+               nil))))
+
     ;; Note: Can't get bogus hits inside template arglists below since they
     ;; have gotten paren syntax above.
     (when (and
index 705f723d55dc790d6509c999bb23ef5f710eb8ad..10fed6d77fc1cfa12dd02229608cfe6f566fc93a 100644 (file)
@@ -2264,6 +2264,10 @@ contain type identifiers."
            ;; MSVC extension.
            "__declspec"))
 
+(c-lang-defconst c-paren-nontype-key
+  t (c-make-keywords-re t (c-lang-const c-paren-nontype-kwds)))
+(c-lang-defvar c-paren-nontype-key (c-lang-const c-paren-nontype-key))
+
 (c-lang-defconst c-paren-type-kwds
   "Keywords that may be followed by a parenthesis expression containing
 type identifiers separated by arbitrary tokens."