X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/59db4308b546cbe32d3bfe6e23dbc1899d511975..7380990:/lisp/progmodes/cc-langs.el diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 07f5ef44d1..08d84fbb62 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1,6 +1,6 @@ ;;; cc-langs.el --- language specific settings for CC Mode -*- coding: utf-8 -*- -;; Copyright (C) 1985, 1987, 1992-2015 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1987, 1992-2016 Free Software Foundation, Inc. ;; Authors: 2002- Alan Mackenzie ;; 1998- Martin Stjernholm @@ -130,7 +130,7 @@ ;; This file is not always loaded. See note above. -(cc-external-require 'cl) +(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl)) ;;; Setup for the `c-lang-defvar' system. @@ -251,19 +251,19 @@ the evaluated constant value at compile time." (unless xlate (setq xlate 'identity)) (c-with-syntax-table (c-lang-const c-mode-syntax-table) - (delete-duplicates - (mapcan (lambda (opgroup) - (when (if (symbolp (car opgroup)) - (when (funcall opgroup-filter (car opgroup)) - (setq opgroup (cdr opgroup)) - t) - t) - (mapcan (lambda (op) - (when (funcall op-filter op) - (let ((res (funcall xlate op))) - (if (listp res) res (list res))))) - opgroup))) - ops) + (c--delete-duplicates + (c--mapcan (lambda (opgroup) + (when (if (symbolp (car opgroup)) + (when (funcall opgroup-filter (car opgroup)) + (setq opgroup (cdr opgroup)) + t) + t) + (c--mapcan (lambda (op) + (when (funcall op-filter op) + (let ((res (funcall xlate op))) + (if (listp res) res (list res))))) + opgroup))) + ops) :test 'equal)))) @@ -327,7 +327,7 @@ the evaluated constant value at compile time." (defun c-populate-syntax-table (table) "Populate the given syntax table as necessary for a C-like language. -This includes setting ' and \" as string delimiters, and setting up +This includes setting \\=' and \" as string delimiters, and setting up the comment syntax to handle both line style \"//\" and block style \"/*\" \"*/\" comments." @@ -403,7 +403,9 @@ The syntax tables aren't stored directly since they're quite large." table))) (c-lang-defvar c++-template-syntax-table (and (c-lang-const c++-make-template-syntax-table) - (funcall (c-lang-const c++-make-template-syntax-table)))) + ;; The next eval remove a superfluous ' from '(lambda. This + ;; gets rid of compilation warnings. + (funcall (eval (c-lang-const c++-make-template-syntax-table))))) (c-lang-defconst c-make-no-parens-syntax-table ;; A variant of the standard syntax table which is used to find matching @@ -426,7 +428,8 @@ The syntax tables aren't stored directly since they're quite large." table)))) (c-lang-defvar c-no-parens-syntax-table (and (c-lang-const c-make-no-parens-syntax-table) - (funcall (c-lang-const c-make-no-parens-syntax-table)))) + ;; See comment in `c++template-syntax-table' about the next `eval'. + (funcall (eval (c-lang-const c-make-no-parens-syntax-table))))) (c-lang-defconst c-identifier-syntax-modifications "A list that describes the modifications that should be done to the @@ -457,7 +460,7 @@ the new syntax, as accepted by `modify-syntax-entry'." (modify-syntax-entry (car mod) (cdr mod) table)) table) "Syntax table built on the mode syntax table but additionally -classifies symbol constituents like '_' and '$' as word constituents, +classifies symbol constituents like `_' and `$' as word constituents, so that all identifiers are recognized as words.") (c-lang-defconst c-get-state-before-change-functions @@ -496,8 +499,13 @@ parameters \(point-min) and \(point-max).") ;; For documentation see the following c-lang-defvar of the same name. ;; The value here may be a list of functions or a single function. t 'c-change-expand-fl-region - (c c++ objc) '(c-neutralize-syntax-in-and-mark-CPP - c-change-expand-fl-region) + (c objc) '(c-neutralize-syntax-in-and-mark-CPP + c-change-expand-fl-region) + c++ '(c-neutralize-syntax-in-and-mark-CPP + c-restore-<>-properties + c-change-expand-fl-region) + java '(c-restore-<>-properties + c-change-expand-fl-region) awk 'c-awk-extend-and-syntax-tablify-region) (c-lang-defvar c-before-font-lock-functions (let ((fs (c-lang-const c-before-font-lock-functions))) @@ -523,8 +531,8 @@ When the mode is initialized, these functions are called with parameters \(point-min), \(point-max) and .") (c-lang-defconst c-before-context-fontification-functions - awk nil - t 'c-context-expand-fl-region) + t 'c-context-expand-fl-region + awk nil) ;; For documentation see the following c-lang-defvar of the same name. ;; The value here may be a list of functions or a single function. (c-lang-defvar c-before-context-fontification-functions @@ -578,8 +586,8 @@ EOL terminated statements." (c-lang-defvar c-has-bitfields (c-lang-const c-has-bitfields)) (c-lang-defconst c-modified-constant - "Regexp that matches a \"modified\" constant literal such as \"L'a'\", -a \"long character\". In particular, this recognizes forms of constant + "Regexp that matches a “modified” constant literal such as \"L\\='a\\='\", +a “long character”. In particular, this recognizes forms of constant which `c-backward-sexp' needs to be called twice to move backwards over." t nil (c c++ objc) "L'\\([^\\'\t\f\n\r]\\|\\\\.\\)'") @@ -870,7 +878,7 @@ definition, or nil if the language doesn't have any." t (if (c-lang-const c-opt-cpp-macro-define) (concat (c-lang-const c-opt-cpp-prefix) (c-lang-const c-opt-cpp-macro-define) - "[ \t]+\\(\\(\\sw\\|_\\)+\\)\\(\([^\)]*\)\\)?" + "[ \t]+\\(\\(\\sw\\|_\\)+\\)\\(([^)]*)\\)?" ;; ^ ^ #defined name "\\([ \t]\\|\\\\\n\\)*"))) (c-lang-defvar c-opt-cpp-macro-define-start @@ -926,14 +934,14 @@ following elements. The car of each element describes the type of the operator group, and the cdr is a list of the operator tokens in it. The operator group types are: -'prefix Unary prefix operators. -'postfix Unary postfix operators. -'postfix-if-paren +`prefix' Unary prefix operators. +`postfix' Unary postfix operators. +`postfix-if-paren' Unary postfix operators if and only if the chars have parenthesis syntax. -'left-assoc Binary left associative operators (i.e. a+b+c means (a+b)+c). -'right-assoc Binary right associative operators (i.e. a=b=c means a=(b=c)). -'right-assoc-sequence +`left-assoc' Binary left associative operators (i.e. a+b+c means (a+b)+c). +`right-assoc' Binary right associative operators (i.e. a=b=c means a=(b=c)). +`right-assoc-sequence' Right associative operator that constitutes of a sequence of tokens that separate expressions. All the tokens in the group are in this case taken as @@ -1165,9 +1173,9 @@ operators." (c-lang-defconst c-all-op-syntax-tokens ;; List of all tokens in the punctuation and parenthesis syntax ;; classes. - t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) - (c-lang-const c-operator-list)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) + (c-lang-const c-operator-list)) + :test 'string-equal)) (c-lang-defconst c-nonsymbol-token-char-list ;; List containing all chars not in the word, symbol or @@ -1190,7 +1198,7 @@ operators." t (c-make-keywords-re nil (c-filter-ops (c-lang-const c-all-op-syntax-tokens) t - "\\`\\(\\s.\\|\\s\(\\|\\s\)\\)+\\'"))) + "\\`\\(\\s.\\)+\\'"))) (c-lang-defvar c-nonsymbol-token-regexp (c-lang-const c-nonsymbol-token-regexp)) @@ -1204,9 +1212,9 @@ operators." "=\\([^=]\\|$\\)" "\\|" (c-make-keywords-re nil - (set-difference (c-lang-const c-assignment-operators) - '("=") - :test 'string-equal))) + (c--set-difference (c-lang-const c-assignment-operators) + '("=") + :test 'string-equal))) "\\<\\>")) (c-lang-defvar c-assignment-op-regexp (c-lang-const c-assignment-op-regexp)) @@ -1256,7 +1264,7 @@ operators." ;; multicharacter tokens that begin with ">" except for those beginning with ;; ">>". t (c-make-keywords-re nil - (set-difference + (c--set-difference (c-lang-const c->-op-cont-tokens) (c-filter-ops (c-lang-const c-all-op-syntax-tokens) t @@ -1430,6 +1438,14 @@ properly." "\\)\\s *")) (c-lang-setvar comment-start-skip (c-lang-const comment-start-skip)) +(c-lang-defconst comment-end-can-be-escaped + "When non-nil, escaped EOLs inside comments are valid. +This works in Emacs >= 25.1." + t nil + (c c++ objc) t) +(c-lang-setvar comment-end-can-be-escaped + (c-lang-const comment-end-can-be-escaped)) + (c-lang-defconst c-syntactic-ws-start ;; Regexp matching any sequence that can start syntactic whitespace. ;; The only uncertain case is '#' when there are cpp directives. @@ -1694,7 +1710,7 @@ be a subset of `c-primitive-type-kwds'." "strong")) (c-lang-defconst c-typedef-kwds - "Prefix keyword\(s\) like \"typedef\" which make a type declaration out + "Prefix keyword(s) like \"typedef\" which make a type declaration out of a variable declaration." t '("typedef") (awk idl java) nil) @@ -1765,10 +1781,10 @@ not the type face." (c-lang-defconst c-type-start-kwds ;; All keywords that can start a type (i.e. are either a type prefix ;; or a complete type). - t (delete-duplicates (append (c-lang-const c-primitive-type-kwds) - (c-lang-const c-type-prefix-kwds) - (c-lang-const c-type-modifier-kwds)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-primitive-type-kwds) + (c-lang-const c-type-prefix-kwds) + (c-lang-const c-type-modifier-kwds)) + :test 'string-equal)) (c-lang-defconst c-class-decl-kwds "Keywords introducing declarations where the following block (if any) @@ -2030,16 +2046,16 @@ one of `c-type-list-kwds', `c-ref-list-kwds', ;; something is a type or just some sort of macro in front of the ;; declaration. They might be ambiguous with types or type ;; prefixes. - t (delete-duplicates (append (c-lang-const c-class-decl-kwds) - (c-lang-const c-brace-list-decl-kwds) - (c-lang-const c-other-block-decl-kwds) - (c-lang-const c-typedef-decl-kwds) - (c-lang-const c-typeless-decl-kwds) - (c-lang-const c-modifier-kwds) - (c-lang-const c-other-decl-kwds) - (c-lang-const c-decl-start-kwds) - (c-lang-const c-decl-hangon-kwds)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-class-decl-kwds) + (c-lang-const c-brace-list-decl-kwds) + (c-lang-const c-other-block-decl-kwds) + (c-lang-const c-typedef-decl-kwds) + (c-lang-const c-typeless-decl-kwds) + (c-lang-const c-modifier-kwds) + (c-lang-const c-other-decl-kwds) + (c-lang-const c-decl-start-kwds) + (c-lang-const c-decl-hangon-kwds)) + :test 'string-equal)) (c-lang-defconst c-prefix-spec-kwds-re ;; Adorned regexp of `c-prefix-spec-kwds'. @@ -2052,10 +2068,10 @@ one of `c-type-list-kwds', `c-ref-list-kwds', ;; ambiguous with types or type prefixes. These are the keywords (like ;; extern, namespace, but NOT template) that can modify a declaration. t (c-make-keywords-re t - (set-difference (c-lang-const c-prefix-spec-kwds) - (append (c-lang-const c-type-start-kwds) - (c-lang-const c-<>-arglist-kwds)) - :test 'string-equal))) + (c--set-difference (c-lang-const c-prefix-spec-kwds) + (append (c-lang-const c-type-start-kwds) + (c-lang-const c-<>-arglist-kwds)) + :test 'string-equal))) (c-lang-defvar c-specifier-key (c-lang-const c-specifier-key)) (c-lang-defconst c-postfix-spec-kwds @@ -2068,19 +2084,19 @@ one of `c-type-list-kwds', `c-ref-list-kwds', ;; Adorned regexp matching all keywords that can't appear at the ;; start of a declaration. t (c-make-keywords-re t - (set-difference (c-lang-const c-keywords) - (append (c-lang-const c-type-start-kwds) - (c-lang-const c-prefix-spec-kwds) - (c-lang-const c-typeof-kwds)) - :test 'string-equal))) + (c--set-difference (c-lang-const c-keywords) + (append (c-lang-const c-type-start-kwds) + (c-lang-const c-prefix-spec-kwds) + (c-lang-const c-typeof-kwds)) + :test 'string-equal))) (c-lang-defvar c-not-decl-init-keywords (c-lang-const c-not-decl-init-keywords)) (c-lang-defconst c-not-primitive-type-keywords "List of all keywords apart from primitive types (like \"int\")." - t (set-difference (c-lang-const c-keywords) - (c-lang-const c-primitive-type-kwds) - :test 'string-equal) + t (c--set-difference (c-lang-const c-keywords) + (c-lang-const c-primitive-type-kwds) + :test 'string-equal) ;; The "more" for C++ is the QT keyword (as in "more slots:"). ;; This variable is intended for use in c-beginning-of-statement-1. c++ (append (c-lang-const c-not-primitive-type-keywords) '("more"))) @@ -2101,7 +2117,7 @@ one of `c-type-list-kwds', `c-ref-list-kwds', "Keywords introducing declarations that can contain a block which might be followed by variable declarations, e.g. like \"foo\" in \"class Foo { ... } foo;\". So if there is a block in a declaration -like that, it ends with the following ';' and not right away. +like that, it ends with the following `;' and not right away. The keywords on list are assumed to also be present on one of the `*-decl-kwds' lists." @@ -2202,7 +2218,7 @@ regexp if `c-colon-type-list-kwds' isn't nil." ;; before the ":" that starts the inherit list after "class" ;; or "struct" in C++. (Also used as default for other ;; languages.) - "[^\]\[{}();,/#=:]*:")) + "[^][{}();,/#=:]*:")) (c-lang-defvar c-colon-type-list-re (c-lang-const c-colon-type-list-re)) (c-lang-defconst c-paren-nontype-kwds @@ -2224,9 +2240,9 @@ type identifiers separated by arbitrary tokens." pike '("array" "function" "int" "mapping" "multiset" "object" "program")) (c-lang-defconst c-paren-any-kwds - t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds) - (c-lang-const c-paren-type-kwds)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-paren-nontype-kwds) + (c-lang-const c-paren-type-kwds)) + :test 'string-equal)) (c-lang-defconst c-<>-type-kwds "Keywords that may be followed by an angle bracket expression @@ -2250,9 +2266,9 @@ assumed to be set if this isn't nil." (c-lang-defconst c-<>-sexp-kwds ;; All keywords that can be followed by an angle bracket sexp. - t (delete-duplicates (append (c-lang-const c-<>-type-kwds) - (c-lang-const c-<>-arglist-kwds)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-<>-type-kwds) + (c-lang-const c-<>-arglist-kwds)) + :test 'string-equal)) (c-lang-defconst c-opt-<>-sexp-key ;; Adorned regexp matching keywords that can be followed by an angle @@ -2310,9 +2326,9 @@ Keywords here should also be in `c-block-stmt-1-kwds'." (c-lang-defconst c-block-stmt-kwds ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. - t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) - (c-lang-const c-block-stmt-2-kwds)) - :test 'string-equal)) + t (c--delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) + (c-lang-const c-block-stmt-2-kwds)) + :test 'string-equal)) (c-lang-defconst c-opt-block-stmt-key ;; Regexp matching the start of any statement that has a @@ -2344,7 +2360,7 @@ Keywords here should also be in `c-block-stmt-1-kwds'." (c-lang-defconst c-paren-stmt-kwds "Statement keywords followed by a parenthesis expression that -nevertheless contains a list separated with ';' and not ','." +nevertheless contains a list separated with `;' and not `,'." t '("for") idl nil) @@ -2366,7 +2382,7 @@ nevertheless contains a list separated with ';' and not ','." (c-lang-defvar c-opt-asm-stmt-key (c-lang-const c-opt-asm-stmt-key)) (c-lang-defconst c-case-kwds - "The keyword\(s) which introduce a \"case\" like construct. + "The keyword(s) which introduce a \"case\" like construct. This construct is \" :\"." t '("case") awk nil) @@ -2417,7 +2433,7 @@ This construct is \" :\"." (c-lang-defconst c-expr-kwds ;; Keywords that can occur anywhere in expressions. Built from ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'. - t (delete-duplicates + t (c--delete-duplicates (append (c-lang-const c-primary-expr-kwds) (c-filter-ops (c-lang-const c-operator-list) t @@ -2468,12 +2484,12 @@ Note that Java specific rules are currently applied to tell this from t (let* ((decl-kwds (append (c-lang-const c-class-decl-kwds) (c-lang-const c-other-block-decl-kwds) (c-lang-const c-inexpr-class-kwds))) - (unambiguous (set-difference decl-kwds - (c-lang-const c-type-start-kwds) - :test 'string-equal)) - (ambiguous (intersection decl-kwds - (c-lang-const c-type-start-kwds) - :test 'string-equal))) + (unambiguous (c--set-difference decl-kwds + (c-lang-const c-type-start-kwds) + :test 'string-equal)) + (ambiguous (c--intersection decl-kwds + (c-lang-const c-type-start-kwds) + :test 'string-equal))) (if ambiguous (concat (c-make-keywords-re t unambiguous) "\\|" @@ -2521,7 +2537,7 @@ Note that Java specific rules are currently applied to tell this from (c-lang-defconst c-keywords ;; All keywords as a list. - t (delete-duplicates + t (c--delete-duplicates (c-lang-defconst-eval-immediately `(append ,@(mapcar (lambda (kwds-lang-const) `(c-lang-const ,kwds-lang-const)) @@ -2585,6 +2601,7 @@ Note that Java specific rules are currently applied to tell this from (setplist (intern kwd obarray) ;; Emacs has an odd bug that causes `mapcan' to fail ;; with unintelligible errors. (XEmacs works.) + ;; (2015-06-24): This bug has not yet been fixed. ;;(mapcan (lambda (lang-const) ;; (list lang-const t)) ;; lang-const-list) @@ -2597,10 +2614,10 @@ Note that Java specific rules are currently applied to tell this from ;; Adorned regexp matching all keywords that should be fontified ;; with the keywords face. I.e. that aren't types or constants. t (c-make-keywords-re t - (set-difference (c-lang-const c-keywords) - (append (c-lang-const c-primitive-type-kwds) - (c-lang-const c-constant-kwds)) - :test 'string-equal))) + (c--set-difference (c-lang-const c-keywords) + (append (c-lang-const c-primitive-type-kwds) + (c-lang-const c-constant-kwds)) + :test 'string-equal))) (c-lang-defvar c-regular-keywords-regexp (c-lang-const c-regular-keywords-regexp)) @@ -2635,12 +2652,12 @@ Note that Java specific rules are currently applied to tell this from right-assoc-sequence) t)) - (unambiguous-prefix-ops (set-difference nonkeyword-prefix-ops - in-or-postfix-ops - :test 'string-equal)) - (ambiguous-prefix-ops (intersection nonkeyword-prefix-ops - in-or-postfix-ops - :test 'string-equal))) + (unambiguous-prefix-ops (c--set-difference nonkeyword-prefix-ops + in-or-postfix-ops + :test 'string-equal)) + (ambiguous-prefix-ops (c--intersection nonkeyword-prefix-ops + in-or-postfix-ops + :test 'string-equal))) (concat "\\(" @@ -2648,14 +2665,14 @@ Note that Java specific rules are currently applied to tell this from ;; first submatch from them together with `c-primary-expr-kwds'. (c-make-keywords-re t (append (c-lang-const c-primary-expr-kwds) - (set-difference prefix-ops nonkeyword-prefix-ops - :test 'string-equal))) + (c--set-difference prefix-ops nonkeyword-prefix-ops + :test 'string-equal))) "\\|" ;; Match all ambiguous operators. (c-make-keywords-re nil - (intersection nonkeyword-prefix-ops in-or-postfix-ops - :test 'string-equal)) + (c--intersection nonkeyword-prefix-ops in-or-postfix-ops + :test 'string-equal)) "\\)" "\\|" @@ -2670,8 +2687,8 @@ Note that Java specific rules are currently applied to tell this from "\\|" ;; The unambiguous operators from `prefix-ops'. (c-make-keywords-re nil - (set-difference nonkeyword-prefix-ops in-or-postfix-ops - :test 'string-equal)) + (c--set-difference nonkeyword-prefix-ops in-or-postfix-ops + :test 'string-equal)) "\\|" ;; Match string and character literals. @@ -2728,25 +2745,25 @@ more info." ;; more quickly. We match ")" in C for K&R region declarations, and ;; in all languages except Java for when a cpp macro definition ;; begins with a declaration. - t "\\([\{\}\(\);,]+\\)" - java "\\([\{\}\(;,<]+\\)" + t "\\([{}();,]+\\)" + java "\\([{}(;,<]+\\)" ;; Match "<" in C++ to get the first argument in a template arglist. ;; In that case there's an additional check in `c-find-decl-spots' ;; that it got open paren syntax. Match ":" to aid in picking up ;; "public:", etc. This involves additional checks in ;; `c-find-decl-prefix-search' to prevent a match of identifiers ;; or labels. - c++ "\\([\{\}\(\);:,<]+\\)" + c++ "\\([{}();:,<]+\\)" ;; Additionally match the protection directives in Objective-C. ;; Note that this doesn't cope with the longer directives, which we ;; would have to match from start to end since they don't end with ;; any easily recognized characters. - objc (concat "\\([\{\}\(\);,]+\\|" + objc (concat "\\([{}();,]+\\|" (c-make-keywords-re nil (c-lang-const c-protection-kwds)) "\\)") ;; Pike is like C but we also match "[" for multiple value ;; assignments and type casts. - pike "\\([\{\}\(\)\[;,]+\\)") + pike "\\([{}()[;,]+\\)") (c-lang-defvar c-decl-prefix-re (c-lang-const c-decl-prefix-re) 'dont-doc) @@ -2791,7 +2808,7 @@ constructs." ;; languages without casts. t (c-filter-ops (c-lang-const c-operators) '(prefix) - "\\`\\s\(\\'" + "\\`\\s(\\'" (lambda (op) (elt op 0)))) (c-lang-defvar c-cast-parens (c-lang-const c-cast-parens)) @@ -2805,7 +2822,7 @@ the \"class Foo: public Bar\" part of: If parens can occur, the chars inside those aren't filtered with this list. -'<' and '>' should be disallowed even if angle bracket arglists can +`<' and `>' should be disallowed even if angle bracket arglists can occur. That since the search function needs to stop at them anyway to ensure they are given paren syntax. @@ -2816,7 +2833,7 @@ possible for good performance." ;; Default to all chars that only occurs in nonsymbol tokens outside ;; identifiers. - t (set-difference + t (c--set-difference (c-lang-const c-nonsymbol-token-char-list) (c-filter-ops (append (c-lang-const c-identifier-ops) (list (cons nil @@ -2833,26 +2850,26 @@ possible for good performance." ;; Allow cpp operations (where applicable). t (if (c-lang-const c-opt-cpp-prefix) - (set-difference (c-lang-const c-block-prefix-disallowed-chars) - '(?#)) + (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?#)) (c-lang-const c-block-prefix-disallowed-chars)) ;; Allow ':' for inherit list starters. - (c++ objc idl) (set-difference (c-lang-const c-block-prefix-disallowed-chars) - '(?:)) + (c++ objc idl) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?:)) ;; Allow ',' for multiple inherits. - (c++ java) (set-difference (c-lang-const c-block-prefix-disallowed-chars) - '(?,)) + (c++ java) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?,)) ;; Allow parentheses for anonymous inner classes in Java and class ;; initializer lists in Pike. - (java pike) (set-difference (c-lang-const c-block-prefix-disallowed-chars) - '(?\( ?\))) + (java pike) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?\( ?\))) ;; Allow '"' for extern clauses (e.g. extern "C" {...}). - (c c++ objc) (set-difference (c-lang-const c-block-prefix-disallowed-chars) - '(?\" ?'))) + (c c++ objc) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) + '(?\" ?'))) (c-lang-defconst c-block-prefix-charset ;; `c-block-prefix-disallowed-chars' as an inverted charset suitable @@ -2874,13 +2891,13 @@ Identifier syntax is in effect when this is matched \(see ;; Check that there's no "=" afterwards to avoid matching tokens ;; like "*=". (c objc) (concat "\\(" - "[*\(]" + "[*(]" "\\|" (c-lang-const c-type-decl-prefix-key) "\\)" "\\([^=]\\|$\\)") c++ (concat "\\(" - "[*\(&]" + "[*(&]" "\\|" (c-lang-const c-type-decl-prefix-key) "\\|" @@ -2908,13 +2925,13 @@ is in effect when this is matched (see `c-identifier-syntax-table')." ;; Default to a regexp that matches `c-type-modifier-kwds' and a ;; function argument list parenthesis. t (if (c-lang-const c-type-modifier-kwds) - (concat "\\(\(\\|" + (concat "\\((\\|" (regexp-opt (c-lang-const c-type-modifier-kwds) t) "\\>" "\\)") - "\\(\(\\)") + "\\((\\)") (c c++ objc) (concat "\\(" - "[\)\[\(]" + "[)[(]" (if (c-lang-const c-type-modifier-kwds) (concat "\\|" @@ -2925,8 +2942,8 @@ is in effect when this is matched (see `c-identifier-syntax-table')." "\\>") "") "\\)") - java "\\([\[\(\)]\\)" - idl "\\([\[\(]\\)") + java "\\([[()]\\)" + idl "\\([[(]\\)") (c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key) 'dont-doc) @@ -3110,7 +3127,7 @@ i.e. compound statements surrounded by parentheses inside expressions." t (if (c-lang-const c-opt-<>-arglist-start) (concat "\\(" (c-lang-const c-opt-<>-arglist-start) - "\\)\\|\\s\)"))) + "\\)\\|\\s)"))) (c-lang-defvar c-opt-<>-arglist-start-in-paren (c-lang-const c-opt-<>-arglist-start-in-paren)) @@ -3157,17 +3174,17 @@ i.e. before \":\". Only used if `c-recognize-colon-labels' is set." t (concat ;; All keywords except `c-label-kwds' and `c-protection-kwds'. (c-make-keywords-re t - (set-difference (c-lang-const c-keywords) - (append (c-lang-const c-label-kwds) - (c-lang-const c-protection-kwds)) - :test 'string-equal))) + (c--set-difference (c-lang-const c-keywords) + (append (c-lang-const c-label-kwds) + (c-lang-const c-protection-kwds)) + :test 'string-equal))) ;; Don't allow string literals, except in AWK. Character constants are OK. (c objc java pike idl) (concat "\"\\|" (c-lang-const c-nonlabel-token-key)) ;; Also check for open parens in C++, to catch member init lists in ;; constructors. We normally allow it so that macros with arguments ;; work in labels. - c++ (concat "\\s\(\\|\"\\|" (c-lang-const c-nonlabel-token-key))) + c++ (concat "\\s(\\|\"\\|" (c-lang-const c-nonlabel-token-key))) (c-lang-defvar c-nonlabel-token-key (c-lang-const c-nonlabel-token-key)) (c-lang-defconst c-nonlabel-token-2-key @@ -3215,7 +3232,7 @@ way." "\\([+-]\\)" (c-lang-const c-simple-ws) "*" (concat "\\(" ; Return type. - "([^\)]*)" + "([^)]*)" (c-lang-const c-simple-ws) "*" "\\)?") "\\(" (c-lang-const c-symbol-key) "\\)")) @@ -3280,16 +3297,16 @@ accomplish that conveniently." ;; `c-lang-const' will expand to the evaluated ;; constant immediately in `c--macroexpand-all' ;; below. - (mapcan + (c--mapcan (lambda (init) `(current-var ',(car init) - ,(car init) ,(c--macroexpand-all - (elt init 1)))) + ,(car init) ,(c--macroexpand-all + (elt init 1)))) ;; Note: The following `append' copies the ;; first argument. That list is small, so ;; this doesn't matter too much. - (append (cdr c-emacs-variable-inits) - (cdr c-lang-variable-inits))))) + (append (cdr c-emacs-variable-inits) + (cdr c-lang-variable-inits))))) ;; This diagnostic message isn't useful for end ;; users, so it's disabled. @@ -3303,10 +3320,9 @@ accomplish that conveniently." (setq source-eval t) (let ((init ',(append (cdr c-emacs-variable-inits) (cdr c-lang-variable-inits)))) - (while init - (setq current-var (caar init)) - (set (caar init) (eval (cadar init))) - (setq init (cdr init))))) + (dolist (var-init init) + (setq current-var (car var-init)) + (set (car var-init) (eval (cadr var-init)))))) (error (if current-var @@ -3332,10 +3348,9 @@ accomplish that conveniently." (c-make-emacs-variables-local) (condition-case err - (while init - (setq current-var (caar init)) - (set (caar init) (eval (cadar init))) - (setq init (cdr init))) + (dolist (var-init init) + (setq current-var (car var-init)) + (set (car var-init) (eval (cadr var-init)))) (error (if current-var @@ -3355,8 +3370,8 @@ evaluated and should not be quoted." (cc-provide 'cc-langs) -;;; Local Variables: -;;; indent-tabs-mode: t -;;; tab-width: 8 -;;; End: +;; Local Variables: +;; indent-tabs-mode: t +;; tab-width: 8 +;; End: ;;; cc-langs.el ends here