]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-langs.el
Update copyright year to 2015
[gnu-emacs] / lisp / progmodes / cc-langs.el
index 2a5db6d3c866385277a1089f95b10c493caf6f93..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
@@ -1932,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.
@@ -2384,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
@@ -2991,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
@@ -3345,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