From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32065 invoked by alias); 19 Apr 2012 02:02:41 -0000 Received: (qmail 32027 invoked by uid 22791); 19 Apr 2012 02:02:40 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Apr 2012 02:02:01 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SKgh6-0003ux-JN from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 18 Apr 2012 19:02:00 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 18 Apr 2012 19:01:17 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Wed, 18 Apr 2012 19:01:59 -0700 Message-ID: <4F8F722D.40603@codesourcery.com> Date: Thu, 19 Apr 2012 04:14:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Subject: [committed] : [PATCH] Check code stype in Emacs: gdb-code-style.el References: <1334378614-13787-1-git-send-email-yao@codesourcery.com> <8762cz1qyn.fsf@fleche.redhat.com> In-Reply-To: <8762cz1qyn.fsf@fleche.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00613.txt.bz2 On 04/17/2012 02:17 AM, Tom Tromey wrote: > Could you make this conform to the elisp comment-header guidelines? > See (info "(elisp) Library Headers"). > > With this change people can M-x package-install-file the .el if they > want. (In fact that is a decent way to test the headers; package.el is > kind of picky about the formatting.) > > Ok with that change. This is what I committed with some minor changes to comply to comment header guidelines. http://sourceware.org/ml/gdb-cvs/2012-04/msg00139.html -- Yao (齐尧) gdb: * gdb-code-style.el: New. --- gdb/gdb-code-style.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) create mode 100644 gdb/gdb-code-style.el diff --git a/gdb/gdb-code-style.el b/gdb/gdb-code-style.el new file mode 100644 index 0000000..5897831 --- /dev/null +++ b/gdb/gdb-code-style.el @@ -0,0 +1,48 @@ +;;; gdb-code-style.el --- code style checker for GDB contributors + +;; Copyright (C) 2012 Free Software Foundation, Inc. + +;; Author: Yao Qi +;; Created: 17 April 2012 +;; Version: 1.0 +;; Keywords: GDB + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; These hooks defined in this file provide some code style checks in +;; Emacs. You can load it in your ~/.emacs, +;; (load-file "~/$(GDB_SOURCE)/gdb/gdb-code-style.el") + + +;;; Code: + +;; Don't use these functions. Their alternatives are better. This list +;; of functions is from ARI rules. +(defun gdb-fun-name-hook () + (font-lock-add-keywords + nil + '(("\\<\\(\\(xasprintf\\|abort\\|vasprintf\\|strerror\\|strdup\\|asprintf\\|sprintf\\)[ ]*\(\\)" 1 font-lock-warning-face t)))) +(add-hook 'c-mode-common-hook 'gdb-fun-name-hook) + +;; Don't include these files directly. +(defun gdb-include-hook () + (font-lock-add-keywords + nil + '(("\\\\)" 1 font-lock-warning-face t)))) + +(add-hook 'c-mode-common-hook 'gdb-include-hook) + +;;; gdb-code-style.el ends here -- 1.7.0.4