From 5977971a97987fb6dcbbc93c045f3cad2b2a1e31 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sun, 29 Apr 2012 07:20:43 +0000 Subject: [PATCH] gdb: * gdb-code-style.el: New hook gdb-markup-hook and gdb-comment-hook. --- gdb/ChangeLog | 5 +++++ gdb/gdb-code-style.el | 31 ++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f1571aeaa3a..1b05cdec293 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-04-29 Yao Qi + + * gdb-code-style.el: New hook gdb-markup-hook + and gdb-comment-hook. + 2012-04-28 Doug Evans Initial support for Fission. http://gcc.gnu.org/wiki/DebugFission diff --git a/gdb/gdb-code-style.el b/gdb/gdb-code-style.el index 58978312e94..28028e6aa34 100644 --- a/gdb/gdb-code-style.el +++ b/gdb/gdb-code-style.el @@ -45,4 +45,33 @@ (add-hook 'c-mode-common-hook 'gdb-include-hook) -;;; gdb-code-style.el ends here \ No newline at end of file +;; Check marker up. If the marker up is missing, like, +;; warning ("abc"); +;; The '(' and '"' will be highlight. +(defun gdb-markup-hook () + (font-lock-add-keywords + nil + '(("\\<\\(warning\\|error\\)[ ]*\\(\([^_]\\)" 2 font-lock-warning-face t)))) + +(add-hook 'c-mode-common-hook 'gdb-markup-hook) + +(defun gdb-comment-hook () + ;; A space should follow "/*", otherwise report a warning. + ;; If the comment is like: + ;; /*F. */ + ;; The 'F' will be highlight. + (font-lock-add-keywords + nil + '(("/\\*\\([^ ]\\).*\\*/" 1 font-lock-warning-face t))) + ;; Two spaces are needed between "." and "*/". Report warning if there + ;; is no space (".*/") or only one space (". */"). + ;; If the comment is like: + ;; /* ABC. */ or /* ABC.*/ + ;; the '.' is highlight. + (font-lock-add-keywords + nil + '(("\\<[[:ascii:]]*\\(\\.[ ]?\\)\\*/" 1 font-lock-warning-face t))) + ) +(add-hook 'c-mode-common-hook 'gdb-comment-hook) + +;;; gdb-code-style.el ends here -- 2.30.2