Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: RFC: add .dir-locals.el
Date: Wed, 11 Apr 2012 23:59:00 -0000	[thread overview]
Message-ID: <4F8614A8.6040800@codesourcery.com> (raw)
In-Reply-To: <87bonj8aa0.fsf@fleche.redhat.com>

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
+                      '(("\\<include[ ]*\\(<\\(stat\\|dirent\\|wait\\|sys/wait\\|assert\\)\\.h>\\)" 1 font-lock-warning-face t)))
+                     ))))
 )


  parent reply	other threads:[~2012-04-11 23:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 18:52 Tom Tromey
2012-03-26 19:06 ` Joel Brobecker
2012-03-26 19:33   ` Tom Tromey
2012-03-28 17:35     ` Tom Tromey
2012-04-11 23:59 ` Yao Qi [this message]
2012-04-12  0:44   ` Joel Brobecker
2012-04-12 16:01   ` Tom Tromey
2012-04-12 16:25   ` Tom Tromey
2012-04-12 19:21   ` Eli Zaretskii
2012-04-12 20:15     ` Tom Tromey
2012-04-13  9:08       ` Eli Zaretskii
2012-04-13 14:05         ` Tom Tromey
2012-04-13 15:22           ` Eli Zaretskii
2012-04-13 15:37       ` Eli Zaretskii
2012-04-13  9:45     ` Yao Qi
2012-04-13 12:48       ` Eli Zaretskii
2012-04-13 13:51         ` Yao Qi
2012-04-13 14:45           ` Pedro Alves
2012-04-13 14:58             ` Tom Tromey
2012-04-13 15:20             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8614A8.6040800@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox