Fix absence of c-noise-macro-name-re, etc., in languages which don't use it

* lisp/progmodes/cc-engine.el (c-forward-keyword-prefixed-id, c-forward-type)
(c-forward-declarator, c-forward-decl-or-cast-1, c-backward-over-enum-header)
(c-guess-basic-syntax): Check c-opt-cpp-prefix before `looking-at'
c-noise-macro-with-parens-name-re.

* lisp/progmodes/cc-fonts.el (c-complex-decl-matchers): The same as for
cc-engine.el.

* lisp/progmodes/cc-mode.el (c-basic-common-init): Add call to
`c-make-noise-macro-regexps'.
(c-mode, c++-mode, objc-mode): Remove calls to `c-make-noise-macro-regexps'.

* lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
(c-noise-macro-with-re): Initialize to "\\<\\>" rather than nil.
This commit is contained in:
Alan Mackenzie
2016-03-25 18:25:08 +00:00
parent 7570b35740
commit 368b9bb45f
4 changed files with 26 additions and 16 deletions

View File

@@ -5838,7 +5838,8 @@ comment at the start of cc-engine.el for more info."
nil
(cond ((looking-at c-keywords-regexp)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause)))))
(when (memq res '(t known found prefix))
,(when (eq type 'ref)
@@ -6506,7 +6507,8 @@ comment at the start of cc-engine.el for more info."
(while (cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq pos (point))
@@ -6911,7 +6913,8 @@ comment at the start of cc-engine.el for more info."
(cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))
((and (looking-at c-type-decl-prefix-key)
(if (and (c-major-mode-is 'c++-mode)
@@ -6966,7 +6969,8 @@ comment at the start of cc-engine.el for more info."
(while (cond
((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(<= (point) limit))
@@ -7161,7 +7165,8 @@ comment at the start of cc-engine.el for more info."
(save-excursion
(c-forward-keyword-clause 1)
(setq kwd-clause-end (point))))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(setq noise-start (point))
(c-forward-noise-clause)
(setq kwd-clause-end (point))))
@@ -7267,7 +7272,8 @@ comment at the start of cc-engine.el for more info."
(while
(cond ((looking-at c-decl-hangon-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq id-start (point)))
@@ -9038,7 +9044,8 @@ comment at the start of cc-engine.el for more info."
((eq (char-after) ?\()
(and (eq (c-backward-token-2) 0)
(or (looking-at c-decl-hangon-key)
(looking-at c-noise-macro-with-parens-name-re))))
(and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re)))))
((and c-recognize-<>-arglists
(eq (char-after) ?<)
@@ -10303,7 +10310,8 @@ comment at the start of cc-engine.el for more info."
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(setq placeholder (c-point 'boi))
(or (consp special-brace-list)
@@ -10359,7 +10367,8 @@ comment at the start of cc-engine.el for more info."
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(c-add-syntax 'defun-open (c-point 'boi))
;; Bogus to use bol here, but it's the legacy. (Resolved,
@@ -10994,7 +11003,8 @@ comment at the start of cc-engine.el for more info."
(while (cond
((looking-at c-specifier-key)
(c-forward-keyword-clause 1))
((looking-at c-noise-macro-with-parens-name-re)
((and c-opt-cpp-prefix
(looking-at c-noise-macro-with-parens-name-re))
(c-forward-noise-clause))))
(c-add-syntax 'brace-list-open (c-point 'boi))))

View File

@@ -1705,7 +1705,9 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
(looking-at "@[A-Za-z0-9]+")))
(c-forward-keyword-clause 1)
t)
(when (looking-at c-noise-macro-with-parens-name-re)
(when (and c-opt-cpp-prefix
(looking-at
c-noise-macro-with-parens-name-re))
(c-forward-noise-clause)
t)))
,(if (c-major-mode-is 'c++-mode)

View File

@@ -596,6 +596,7 @@ that requires a literal mode spec at compile time."
(not (string-equal c-indentation-style
style)))))))
(c-setup-paragraph-variables)
(c-make-noise-macro-regexps)
;; we have to do something special for c-offsets-alist so that the
;; buffer local value has its own alist structure.
@@ -1493,7 +1494,6 @@ Key bindings:
abbrev-mode t)
(use-local-map c-mode-map)
(c-init-language-vars-for 'c-mode)
(c-make-noise-macro-regexps)
(c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
(c-common-init 'c-mode)
(easy-menu-add c-c-menu)
@@ -1549,7 +1549,6 @@ Key bindings:
abbrev-mode t)
(use-local-map c++-mode-map)
(c-init-language-vars-for 'c++-mode)
(c-make-noise-macro-regexps)
(c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
(c-common-init 'c++-mode)
(easy-menu-add c-c++-menu)
@@ -1603,7 +1602,6 @@ Key bindings:
abbrev-mode t)
(use-local-map objc-mode-map)
(c-init-language-vars-for 'objc-mode)
(c-make-noise-macro-regexps)
(c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
(c-common-init 'objc-mode)
(easy-menu-add c-objc-menu)

View File

@@ -1619,8 +1619,8 @@ names)."))
:type 'c-extra-types-widget
:group 'c)
(defvar c-noise-macro-with-parens-name-re nil)
(defvar c-noise-macro-name-re nil)
(defvar c-noise-macro-with-parens-name-re "\\<\\>")
(defvar c-noise-macro-name-re "\\<\\>")
(defcustom c-noise-macro-names nil
"A list of names of macros which expand to nothing, or compiler extensions