;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:24:58 2007 ;;; from file /home/cyd/emacs/lisp/progmodes/cwarn.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`cwarn.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\312\313\314\315& \207" [require custom font-lock cc-mode custom-declare-group cwarn nil "Highlight suspicious C and C++ constructions." :version "21.1" :link (url-link "http://www.andersl.com/emacs") :group faces] 10) #@110 *Non-nil when Cwarn mode is active. Never set this variable directly, use the command `cwarn-mode' instead. (defvar cwarn-mode nil (#$ . -862)) #@421 *List of items each describing which features are enable for a mode. Each item is on the form (mode featurelist), where featurelist can be on one of three forms: * A list of enabled features. * A list starting with the atom `not' followed by the features which are not enabled. * The atom t, that represent that all features are enabled. See variable `cwarn-font-lock-feature-keywords-alist' for available features. (custom-declare-variable 'cwarn-configuration ''((c-mode (not reference)) (c++-mode t)) '(#$ . -1014) :type '(repeat sexp) :group 'cwarn) #@207 An alist mapping a CWarn feature to font-lock keywords. The keywords could either a font-lock keyword list or a symbol. If it is a symbol it is assumed to be a variable containing a font-lock keyword list. (custom-declare-variable 'cwarn-font-lock-feature-keywords-alist ''((assign . cwarn-font-lock-assignment-keywords) (semicolon . cwarn-font-lock-semicolon-keywords) (reference . cwarn-font-lock-reference-keywords)) '(#$ . 1579) :type '(alist :key-type (choice (const assign) (const semicolon) (const reference)) :value-type (sexp :tag "Value")) :group 'cwarn) #@134 *When nil, CWarn mode will not generate any messages. Currently, messages are generated when the mode is activated and deactivated. (custom-declare-variable 'cwarn-verbose 't '(#$ . -2151) :group 'cwarn :type 'boolean) #@136 *String to display in the mode line when CWarn mode is active. (When the string is not empty, make sure that it has a leading space.) (custom-declare-variable 'cwarn-mode-text '" CWarn" '(#$ . -2378) :tag "CWarn mode text" :group 'cwarn :type 'string) #@52 *Functions to run when CWarn mode is first loaded. (custom-declare-variable 'cwarn-load-hook 'nil '(#$ . -2637) :tag "Load Hook" :group 'cwarn :type 'hook) #@89 Non-nil if Cwarn mode is enabled. Use the command `cwarn-mode' to change this variable. (defvar cwarn-mode nil (#$ . 2799)) (make-variable-buffer-local 'cwarn-mode) #@287 Minor mode that highlights suspicious C and C++ constructions. Note, in addition to enabling this minor mode, the major mode must be included in the variable `cwarn-configuration'. By default C and C++ modes are included. With ARG, turn CWarn mode on if and only if arg is positive. (defalias 'cwarn-mode #[(&optional arg) "\303=\203 ?\202%\203\304!\305V\202% \204\306\202%\307\310\301\"\210\311\312 !\210\n\2031\313 \210\314\315 \203;\316\202<\317\"\210\320 \203P\307\321 \203M\322\202N\323\"\210\324 \210 \207" [arg cwarn-mode font-lock-mode toggle prefix-numeric-value 0 t message "Toggling %s off; better pass an explicit argument." nil cwarn-font-lock-keywords font-lock-fontify-buffer run-hooks cwarn-mode-hook cwarn-mode-on-hook cwarn-mode-off-hook called-interactively-p "Cwarn mode %sabled" "en" "dis" force-mode-line-update] 3 (#$ . 2971) (list (or current-prefix-arg 'toggle))]) (byte-code "\300\301\302\303\304!\205 \304J#\207" [add-minor-mode cwarn-mode cwarn-mode-text boundp cwarn-mode-map] 5) #@129 Turn on CWarn mode. This function is designed to be added to hooks, for example: (add-hook 'c-mode-hook 'turn-on-cwarn-mode) (defalias 'turn-on-cwarn-mode #[nil "\300\301!\207" [cwarn-mode 1] 2 (#$ . 4010)]) #@272 Non-nil if CWarn FEATURE is enabled for MODE. feature is an atom representing one construction to highlight. Check if any feature is enabled for MODE if no feature is specified. The valid features are described by the variable `cwarn-font-lock-feature-keywords-alist'. (defalias 'cwarn-is-enabled #[(mode &optional feature) " \236\211\205* ?\206*\nA@\211\305=\206)\f\242\306=\203& \fA>?\202) \f>))\207" [mode cwarn-configuration mode-configuraion feature list-or-t t not] 3 (#$ . 4228)]) #@47 True if point is inside a C macro definition. (defalias 'cwarn-inside-macro #[nil "\212\300 \210`SSf\301=\203\302y\210\202\303 \210\304f)\305=\207" [beginning-of-line 92 -1 back-to-indentation nil 35] 2 (#$ . 4732)]) #@87 Install/Remove keywords into current buffer. If ADDP is non-nil, install else remove. (defalias 'cwarn-font-lock-keywords #[(addp) "\306\211\2036\n@\211@ A <\204 J\307 \f\"\203.\n\203)\310\202*\311\306 \"\210*\nA\211\204*\306\207" [cwarn-font-lock-feature-keywords-alist pair #1=#:--cl-dolist-temp-- keywords feature major-mode nil cwarn-is-enabled font-lock-add-keywords font-lock-remove-keywords addp] 4 (#$ . 4959)]) (byte-code "\300\301!\204 \302\301\303\"\210\300\207" [fboundp c-at-toplevel-p defalias #[nil "\301 \302!?\206 \303!)\207" [state c-parse-state c-most-enclosing-brace c-search-uplist-for-classkey] 2 "Return a determination as to whether point is at the `top-level'.\nBeing at the top-level means that point is either outside any\nenclosing block (such function definition), or inside a class\ndefinition, but outside any method blocks.\n\nIf point is not at the top-level (e.g. it is inside a method\ndefinition), then nil is returned. Otherwise, if point is at a\ntop-level not enclosed within a class definition, t is returned.\nOtherwise, a 2-vector is returned where the zeroth element is the\nbuffer position of the start of the class declaration, and the first\nelement is the buffer position of the enclosing class' opening\nbrace."]] 3) #@34 Match RE but only if BODY holds. (defalias 'cwarn-font-lock-match '(macro . #[(re &rest body) "\302\303\304\305\306\307\310\311BBE\312\307\313\314\315\316\317\320 BD\321BBBEEED\322BBB\207" [re body let ((res nil)) while progn setq res re-search-forward (limit t) and save-excursion (when (match-beginning 1) (goto-char (match-beginning 1))) condition-case nil not save-match-data ((error t)) (res)] 14 (#$ . 6253)])) (byte-code "\301B\302\303!\207" [current-load-list cwarn-font-lock-assignment-keywords (lambda (#1=#:defconst-tmp-var) (defconst cwarn-font-lock-assignment-keywords #1#)) ((cwarn-font-lock-match-assignment-in-expression (1 font-lock-warning-face)))] 2) #@39 Match assignments inside expressions. (defalias 'cwarn-font-lock-match-assignment-in-expression #[(limit) "\302\303\304 \305#\211\203\212\306\224\203\306\224b\210\302\307\310\217)\204)\207" [res limit nil re-search-forward "[^!<>=]\\(\\([-+*/%&^|]\\|<<\\|>>\\)?=\\)[^=]" t 1 (byte-code "\301 \302\216\303\304!\210g\305>\205 \306\307x\210\310\307x\210\311 \206\312\313!?*?\207" [save-match-data-internal match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) backward-up-list 1 (40 91) " " nil "a-zA-Z0-9_" c-at-toplevel-p looking-at "for\\>"] 2) ((error t))] 5 (#$ . 6932)]) (byte-code "\301B\302\303!\207" [current-load-list cwarn-font-lock-semicolon-keywords (lambda (#1=#:defconst-tmp-var) (defconst cwarn-font-lock-semicolon-keywords #1#)) ((cwarn-font-lock-match-dangerous-semicolon (0 font-lock-warning-face)))] 2) #@134 Match semicolons directly after `for', `while', and `if'. The semicolon after a `do { ... } while (x);' construction is not matched. (defalias 'cwarn-font-lock-match-dangerous-semicolon #[(limit) "\302\303\304 \305#\211\203\212\306\224\203\306\224b\210\302\307\310\217)\204)\207" [res limit nil re-search-forward ";" t 1 (byte-code "\301 \302\216\303\304!\210\305\306!\206\305\307!\205\310\311\312\217*?\207" [save-match-data-internal match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) backward-sexp 2 looking-at "\\(for\\|if\\)\\>" "while\\>" nil (byte-code "\300\301!\210\302\303!?\207" [backward-sexp 2 looking-at "do\\>"] 2) ((error t))] 3) ((error t))] 5 (#$ . 7817)]) (byte-code "\301B\302\303!\207" [current-load-list cwarn-font-lock-reference-keywords (lambda (#1=#:defconst-tmp-var) (defconst cwarn-font-lock-reference-keywords #1#)) ((cwarn-font-lock-match-reference (1 font-lock-warning-face)))] 2) #@49 Font-lock matcher for C++ reference parameters. (defalias 'cwarn-font-lock-match-reference #[(limit) "\302\303\304 \305#\211\203\212\306\224\203\306\224b\210\302\307\310\217)\204)\207" [res limit nil re-search-forward "[^&]\\(&\\)[^&=]" t 1 (byte-code "\301 \302\216\303\304!\210g\305=\205\306 ?\205\307 *?\207" [save-match-data-internal match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) backward-up-list 1 40 cwarn-inside-macro c-at-toplevel-p] 2) ((error t))] 5 (#$ . 8795)]) #@158 Turn on CWarn mode in the current buffer if applicable. The mode is turned if some feature is enabled for the current `major-mode' in `cwarn-configuration'. (defalias 'turn-on-cwarn-mode-if-enabled #[nil "\301!\205\302 \207" [major-mode cwarn-is-enabled turn-on-cwarn-mode] 2 (#$ . 9341)]) (byte-code "\301B\302\301!\204\303\301\304\"\210\305\301!\207" [current-load-list cwarn-mode-major-mode default-boundp set-default nil make-variable-buffer-local] 3) #@272 Non-nil if Global-Cwarn mode is enabled. See the command `global-cwarn-mode' for a description of this minor-mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `global-cwarn-mode'. (custom-declare-variable 'global-cwarn-mode 'nil '(#$ . 9811) :set 'custom-set-minor-mode :initialize 'custom-initialize-default :group 'cwarn :type 'boolean) #@261 Toggle Cwarn mode in every possible buffer. With prefix ARG, turn Global-Cwarn mode on if and only if ARG is positive. Cwarn mode is enabled in all buffers where `turn-on-cwarn-mode-if-enabled' would do it. See `cwarn-mode' for more information on Cwarn mode. (defalias 'global-cwarn-mode #[(&optional arg) "\305=\203 ?\202%\203\306!\307V\202% \204\310\202%\311\312\301\"\210\313\211\203<\314\315\316\"\210\314\317\320\"\210\314\321\322\"\210\202K\323\315\316\"\210\323\317\320\"\210\323\321\322\"\210\324 \313\211\203u @r\nq\210 \203e\325 \210\202m\f\203m\304\326!\210) A\211\204T*\327\330 \203\200\331\202\201\332\"\210\333 \203\231\334\301!\210\311\335 \203\226\336\202\227\337\"\210\340 \210 \207" [arg global-cwarn-mode buf #1=#:--cl-dolist-temp-- cwarn-mode toggle prefix-numeric-value 0 t message "Toggling %s off; better pass an explicit argument." nil add-hook after-change-major-mode-hook global-cwarn-mode-enable-in-buffers find-file-hook global-cwarn-mode-check-buffers change-major-mode-hook global-cwarn-mode-cmhh remove-hook buffer-list turn-on-cwarn-mode-if-enabled -1 run-hooks global-cwarn-mode-hook global-cwarn-mode-on-hook global-cwarn-mode-off-hook called-interactively-p customize-mark-as-set "Global-Cwarn mode %sabled" "en" "dis" force-mode-line-update] 4 (#$ . 10248) (list (or current-prefix-arg 'toggle))]) (byte-code "\301\302\303\304\305!\205 \305J#\210\306B\307\306!\204\310\306\303\"\210\303\207" [current-load-list add-minor-mode global-cwarn-mode nil boundp global-cwarn-mode-map global-cwarn-mode-buffers default-boundp set-default] 5) (defalias 'global-cwarn-mode-enable-in-buffers #[nil "\306\211\2038\n@\307 !\2031r q\210 \203+\f =\2040\303\310!\210\311 \210 \2020\311 \210 )\nA\211\204*\306\207" [global-cwarn-mode-buffers buf #1=#:--cl-dolist-temp-- cwarn-mode cwarn-mode-major-mode major-mode nil buffer-live-p -1 turn-on-cwarn-mode-if-enabled] 3]) (put 'global-cwarn-mode-enable-in-buffers 'definition-name 'global-cwarn-mode) (defalias 'global-cwarn-mode-check-buffers #[nil "\301 \210\302\303\304\305\"\207" [global-cwarn-mode-buffers global-cwarn-mode-enable-in-buffers nil remove-hook post-command-hook global-cwarn-mode-check-buffers] 3]) (put 'global-cwarn-mode-check-buffers 'definition-name 'global-cwarn-mode) (defalias 'global-cwarn-mode-cmhh #[nil "\300\301p\"\210\302\303\304\"\207" [add-to-list global-cwarn-mode-buffers add-hook post-command-hook global-cwarn-mode-check-buffers] 3]) (byte-code "\300\301\302\303#\210\304\305!\210\306\307!\207" [put global-cwarn-mode-cmhh definition-name global-cwarn-mode provide cwarn run-hooks cwarn-load-hook] 4)