]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-langs.el
Update copyright year to 2015
[gnu-emacs] / lisp / progmodes / cc-langs.el
index bab928ac5dd38f6bb790066358e979ed6fe1700a..17d717e740f4fae443bc807d6a63e0eb1cb7c404 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cc-langs.el --- language specific settings for CC Mode -*- coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1987, 1992-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2015 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -318,9 +318,9 @@ the evaluated constant value at compile time."
        :style toggle :selected c-auto-newline]
        ["Hungry delete"         c-toggle-hungry-state
        :style toggle :selected c-hungry-delete-key]
-       ["Subword mode"          subword-mode
-       :style toggle :selected (and (boundp 'subword-mode)
-                                     subword-mode)])))
+       ["Subword mode"          c-subword-mode
+       :style toggle :selected (and (boundp 'c-subword-mode)
+                                     c-subword-mode)])))
 
 \f
 ;;; Syntax tables.
@@ -577,9 +577,18 @@ EOL terminated statements."
   (c c++ objc) t)
 (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
+which `c-backward-sexp' needs to be called twice to move backwards over."
+  t nil
+  (c c++ objc) "L'\\([^\\'\t\f\n\r]\\|\\\\.\\)'")
+;; FIXME!!!  Extend this to cover strings, if needed.  2008-04-11
+(c-lang-defvar c-modified-constant (c-lang-const c-modified-constant))
+
 (c-lang-defconst c-symbol-start
   "Regexp that matches the start of a symbol, i.e. any identifier or
-keyword.  It's unspecified how far it matches. Does not contain a \\|
+keyword.  It's unspecified how far it matches.  Does not contain a \\|
 operator at the top level."
   t    (concat "[" c-alpha "_]")
   java (concat "[" c-alpha "_@]")
@@ -970,7 +979,8 @@ since CC Mode treats every identifier as an expression."
       ,@(when (c-major-mode-is 'c++-mode)
          ;; The following need special treatment.
          `((prefix "dynamic_cast" "static_cast"
-                   "reinterpret_cast" "const_cast" "typeid")))
+                   "reinterpret_cast" "const_cast" "typeid"
+                    "alignof")))
       (left-assoc "."
                  ,@(unless (c-major-mode-is 'java-mode)
                      '("->")))
@@ -1143,7 +1153,8 @@ operators."
   c++  (append '("&" "<%" "%>" "<:" ":>" "%:" "%:%:")
               (c-lang-const c-other-op-syntax-tokens))
   objc (append '("#" "##"              ; Used by cpp.
-                "+" "-") (c-lang-const c-other-op-syntax-tokens))
+                "+" "-")
+               (c-lang-const c-other-op-syntax-tokens))
   idl  (append '("#" "##")             ; Used by cpp.
               (c-lang-const c-other-op-syntax-tokens))
   pike (append '("..")
@@ -1648,7 +1659,7 @@ the appropriate place for that."
        '("_Bool" "_Complex" "_Imaginary") ; Conditionally defined in C99.
        (c-lang-const c-primitive-type-kwds))
   c++  (append
-       '("bool" "wchar_t")
+       '("bool" "wchar_t" "char16_t" "char32_t")
        (c-lang-const c-primitive-type-kwds))
   ;; Objective-C extends C, but probably not the new stuff in C99.
   objc (append
@@ -1730,7 +1741,7 @@ but they don't build a type of themselves.  Unlike the keywords on
 not the type face."
   t    nil
   c    '("const" "restrict" "volatile")
-  c++  '("const" "volatile" "throw")
+  c++  '("const" "constexpr" "noexcept" "volatile" "throw" "final" "override")
   objc '("const" "volatile"))
 
 (c-lang-defconst c-opt-type-modifier-key
@@ -1807,6 +1818,26 @@ will be handled."
   t (c-make-keywords-re t (c-lang-const c-brace-list-decl-kwds)))
 (c-lang-defvar c-brace-list-key (c-lang-const c-brace-list-key))
 
+(c-lang-defconst c-after-brace-list-decl-kwds
+  "Keywords that might follow keywords in `c-brace-list-decl-kwds'
+and precede the opening brace."
+  t    nil
+  c++  '("class" "struct"))
+
+(c-lang-defconst c-after-brace-list-key
+  ;; Regexp matching keywords that can fall between a brace-list
+  ;; keyword and the associated brace list.
+  t (c-make-keywords-re t (c-lang-const c-after-brace-list-decl-kwds)))
+(c-lang-defvar c-after-brace-list-key (c-lang-const c-after-brace-list-key))
+
+(c-lang-defconst c-recognize-post-brace-list-type-p
+  "Set to t when we recognize a colon and then a type after an enum,
+e.g., enum foo : int { A, B, C };"
+  t nil
+  c++ t)
+(c-lang-defvar c-recognize-post-brace-list-type-p
+              (c-lang-const c-recognize-post-brace-list-type-p))
+
 (c-lang-defconst c-other-block-decl-kwds
   "Keywords where the following block (if any) contains another
 declaration level that should not be considered a class.  For every
@@ -1912,7 +1943,8 @@ If any of these also are on `c-type-list-kwds', `c-ref-list-kwds',
 will be handled."
   t    nil
   (c c++) '("auto" "extern" "inline" "register" "static")
-  c++  (append '("explicit" "friend" "mutable" "template" "using" "virtual")
+  c++  (append '("explicit" "friend" "mutable" "template" "thread_local"
+                 "using" "virtual")
               (c-lang-const c-modifier-kwds))
   objc '("auto" "bycopy" "byref" "extern" "in" "inout" "oneway" "out" "static")
   ;; FIXME: Some of those below ought to be on `c-other-decl-kwds' instead.
@@ -2364,8 +2396,11 @@ This construct is \"<keyword> <expression> :\"."
 (c-lang-defconst c-constant-kwds
   "Keywords for constants."
   t       nil
-  (c c++) '("NULL" ;; Not a keyword, but practically works as one.
+  c       '("NULL" ;; Not a keyword, but practically works as one.
            "false" "true")             ; Defined in C99.
+  c++     (append
+           '("nullptr")
+           (c-lang-const c-constant-kwds))
   objc    '("nil" "Nil" "YES" "NO" "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER")
   idl     '("TRUE" "FALSE")
   java    '("true" "false" "null") ; technically "literals", not keywords
@@ -2971,17 +3006,15 @@ is in effect or not."
          (when (boundp (c-mode-symbol "font-lock-extra-types"))
            (c-mode-var "font-lock-extra-types")))
         (regexp-strings
-         (apply 'nconc
-                (mapcar (lambda (re)
-                   (when (string-match "[][.*+?^$\\]" re)
-                     (list re)))
-                 extra-types)))
+         (delq nil (mapcar (lambda (re)
+                             (when (string-match "[][.*+?^$\\]" re)
+                               re))
+                           extra-types)))
         (plain-strings
-         (apply 'nconc
-                (mapcar (lambda (re)
-                   (unless (string-match "[][.*+?^$\\]" re)
-                     (list re)))
-                 extra-types))))
+         (delq nil (mapcar (lambda (re)
+                             (unless (string-match "[][.*+?^$\\]" re)
+                               re))
+                           extra-types))))
     (concat "\\<\\("
            (c-concat-separated
             (append (list (c-make-keywords-re nil
@@ -3238,7 +3271,7 @@ accomplish that conveniently."
       `(lambda ()
 
         ;; This let sets up the context for `c-mode-var' and similar
-        ;; that could be in the result from `macroexpand-all'.
+        ;; that could be in the result from `c--macroexpand-all'.
         (let ((c-buffer-is-cc-mode ',mode)
               current-var source-eval)
           (c-make-emacs-variables-local)
@@ -3248,12 +3281,12 @@ accomplish that conveniently."
                   (setq ,@(let ((c-buffer-is-cc-mode mode)
                                 (c-lang-const-expansion 'immediate))
                             ;; `c-lang-const' will expand to the evaluated
-                            ;; constant immediately in `macroexpand-all'
+                            ;; constant immediately in `c--macroexpand-all'
                             ;; below.
                              (mapcan
                               (lambda (init)
                                 `(current-var ',(car init)
-                                  ,(car init) ,(macroexpand-all
+                                  ,(car init) ,(c--macroexpand-all
                                                 (elt init 1))))
                               ;; Note: The following `append' copies the
                               ;; first argument.  That list is small, so
@@ -3325,4 +3358,8 @@ evaluated and should not be quoted."
 \f
 (cc-provide 'cc-langs)
 
+;;; Local Variables:
+;;; indent-tabs-mode: t
+;;; tab-width: 8
+;;; End:
 ;;; cc-langs.el ends here