Commit | Line | Data |
---|---|---|
48fe4669 YQ |
1 | ;;; gdb-code-style.el --- code style checker for GDB contributors |
2 | ||
3 | ;; Copyright (C) 2012 Free Software Foundation, Inc. | |
4 | ||
5 | ;; Author: Yao Qi <yao@codesourcery.com> | |
6 | ;; Created: 17 April 2012 | |
7 | ;; Version: 1.0 | |
8 | ;; Keywords: GDB | |
9 | ||
10 | ;; This program is free software; you can redistribute it and/or modify | |
11 | ;; it under the terms of the GNU General Public License as published by | |
12 | ;; the Free Software Foundation; either version 3 of the License, or | |
13 | ;; (at your option) any later version. | |
14 | ||
15 | ;; This program is distributed in the hope that it will be useful, | |
16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;; GNU General Public License for more details. | |
19 | ||
20 | ;; You should have received a copy of the GNU General Public License | |
21 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | ;;; Commentary: | |
24 | ||
25 | ;; These hooks defined in this file provide some code style checks in | |
26 | ;; Emacs. You can load it in your ~/.emacs, | |
27 | ;; (load-file "~/$(GDB_SOURCE)/gdb/gdb-code-style.el") | |
28 | ||
29 | ||
30 | ;;; Code: | |
31 | ||
32 | ;; Don't use these functions. Their alternatives are better. This list | |
33 | ;; of functions is from ARI rules. | |
34 | (defun gdb-fun-name-hook () | |
35 | (font-lock-add-keywords | |
36 | nil | |
37 | '(("\\<\\(\\(xasprintf\\|abort\\|vasprintf\\|strerror\\|strdup\\|asprintf\\|sprintf\\)[ ]*\(\\)" 1 font-lock-warning-face t)))) | |
38 | (add-hook 'c-mode-common-hook 'gdb-fun-name-hook) | |
39 | ||
40 | ;; Don't include these files directly. | |
41 | (defun gdb-include-hook () | |
42 | (font-lock-add-keywords | |
43 | nil | |
44 | '(("\\<include[ ]*\\(<\\(sys/stat\\|stat\\|dirent\\|wait\\|sys/wait\\|assert\\)\\.h>\\)" 1 font-lock-warning-face t)))) | |
45 | ||
46 | (add-hook 'c-mode-common-hook 'gdb-include-hook) | |
47 | ||
48 | ;;; gdb-code-style.el ends here |