From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30272 invoked by alias); 11 Apr 2012 23:33:37 -0000 Received: (qmail 30264 invoked by uid 22791); 11 Apr 2012 23:33:36 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL,BAYES_00,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; Wed, 11 Apr 2012 23:33:14 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1SI72G-00014w-Lh from Yao_Qi@mentor.com ; Wed, 11 Apr 2012 16:33:12 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Apr 2012 16:33:12 -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, 11 Apr 2012 16:33:11 -0700 Message-ID: <4F8614A8.6040800@codesourcery.com> Date: Wed, 11 Apr 2012 23:59: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: Tom Tromey CC: Subject: Re: RFC: add .dir-locals.el References: <87bonj8aa0.fsf@fleche.redhat.com> In-Reply-To: <87bonj8aa0.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/msg00266.txt.bz2 On 03/27/2012 02:52 AM, Tom Tromey wrote: > This adds a .dir-locals.el to gdb. This will cause Emacs to > automatically pick up the correct settings for various variables, so > that users won't have to configure Emacs for editing gdb. > > These settings won't affect any files outside of gdb. Do you think it is useful to add some code here to check code style or check ARI rules? The patch below shows two ARI checks we can do in emacs. The benefit is that code is checked automatically during writing, instead of being pointed out by reviewers. With this change, when emacs opens gdb files for the first time, it prompts to ask apply risky local variables. Not sure GDB contributors using emacs are comfortable with this or not. I have other emacs lisp snippets to do other checks, and personally, I find they are quite useful. If this is acceptable, I'll push them out one by one. -- Yao (齐尧) * gdb/.dir-locals.el: Check improper functions and include files. diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el index 8eca9e0..c41bb1a 100644 --- a/gdb/.dir-locals.el +++ b/gdb/.dir-locals.el @@ -20,5 +20,16 @@ (indent-tabs-mode . t))) (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) (c-mode . ((c-file-style . "GNU") - (indent-tabs-mode . t))) + (indent-tabs-mode . t) + (eval . (progn + ;; Don't use these functions. Their alternatives are better. + ;; This list of functions are from ARI rules. + (font-lock-add-keywords + nil + '(("\\<\\(\\(xasprintf\\|abort\\|vasprintf\\|strerror\\|strdup\\|asprintf\\|sprintf\\)[ ]*\(\\)" 1 font-lock-warning-face t))) + ;; Don't include these files. + (font-lock-add-keywords + nil + '(("\\\\)" 1 font-lock-warning-face t))) + )))) )