From: Andrew Burgess Date: Fri, 28 Feb 2020 18:08:08 +0000 (+0000) Subject: gdbserver/gdbsupport: Add .dir-locals.el file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20ea4a609c44e5795a57c7b409e99442f8a44a0d;p=binutils-gdb.git gdbserver/gdbsupport: Add .dir-locals.el file Copy the .dir-locls.el file from gdb/ to gdbserver/ and gdbsupport/ so that we get the GNU/GDB style when editing these files in Emacs. I initially wanted to remove the (c-mode . ((mode . c++))) that switches c-mode files into c++-mode as we store C++ code in *.cc files in the gdbserver/ directory, unlike gdb/ where we use *.c, however, I was forgetting about the header files - we still use *.h for our C++ header files, so for now I left the settings in place to open all C files in c++-mode. We now have three copies of this file, which are all identical. It would be nice if we could remove this duplication, however, for now we haven't found a good way to do this. Some options considered were: 1. Use symlinks to only have one copy of the file. This was rejected as not all targets support symlinks in the way. 2. Have two of the .dir-locals.el files contain some mechanism by which the third copy of the file is sourced. Though this would, in theory, be possible, it would involve some advanced Emacs scripting, would be fragile, and a maintenance burdon. 3. Move the .dir-locals up into top level src/ directory, then use Emacs dir-locals directory pattern matching to only apply the rules for the three directories we care about. The problem is that each directory has to be listed separately, so we still end up having to duplicate all the rules. In the end, it was decided that having three copies of the file, though not ideal, is probably easiest for now. This was all discussed in this mailing list thread: https://sourceware.org/ml/gdb-patches/2020-03/msg00024.html The copyright date in the new files is left as for gdb/.dir-locals.el, as the new files are a copy of the old, this is inline with this rule: https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header gdb/ChangeLog: * .dir-locals.el: Add a comment referencing the other copies of this file. gdbserver/ChangeLog: * .dir-locals.el: New file. gdbsupport/ChangeLog: * .dir-locals.el: New file. --- diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el index 17df7e327fe..a69571a23f1 100644 --- a/gdb/.dir-locals.el +++ b/gdb/.dir-locals.el @@ -14,6 +14,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . +;; There are three copies of this file, one in each of gdb/, +;; gdbserver/, and gdbsupport/. If you edit any one of these then +;; please replicate the changes in the other two copies. + ( (tcl-mode . ((tcl-indent-level . 4) (tcl-continued-indent-level . 4) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ee0d10d8c98..b3a5e0aa369 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-03-06 Andrew Burgess + + * .dir-locals.el: Add a comment referencing the other copies of + this file. + 2020-03-05 John Baldwin * fbsd-tdep.c (fbsd_make_corefile_notes): Use std::string for diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el new file mode 100644 index 00000000000..a69571a23f1 --- /dev/null +++ b/gdbserver/.dir-locals.el @@ -0,0 +1,41 @@ +;; Emacs settings. +;; Copyright (C) 2012-2020 Free Software Foundation, Inc. + +;; 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 . + +;; There are three copies of this file, one in each of gdb/, +;; gdbserver/, and gdbsupport/. If you edit any one of these then +;; please replicate the changes in the other two copies. + +( + (tcl-mode . ((tcl-indent-level . 4) + (tcl-continued-indent-level . 4) + (indent-tabs-mode . t))) + (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) + (c-mode . ((c-file-style . "GNU") + (mode . c++) + (indent-tabs-mode . t) + (tab-width . 8) + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) + (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style) + (c-toggle-comment-style 1))) + (indent-tabs-mode . t) + (tab-width . 8) + (c-file-style . "GNU") + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) +) diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 4e44a763cc3..16346de8dec 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2020-03-06 Andrew Burgess + + * .dir-locals.el: New file. + 2020-03-05 Tankut Baris Aktemur * .gitattributes: New file. diff --git a/gdbsupport/.dir-locals.el b/gdbsupport/.dir-locals.el new file mode 100644 index 00000000000..a69571a23f1 --- /dev/null +++ b/gdbsupport/.dir-locals.el @@ -0,0 +1,41 @@ +;; Emacs settings. +;; Copyright (C) 2012-2020 Free Software Foundation, Inc. + +;; 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 . + +;; There are three copies of this file, one in each of gdb/, +;; gdbserver/, and gdbsupport/. If you edit any one of these then +;; please replicate the changes in the other two copies. + +( + (tcl-mode . ((tcl-indent-level . 4) + (tcl-continued-indent-level . 4) + (indent-tabs-mode . t))) + (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) + (c-mode . ((c-file-style . "GNU") + (mode . c++) + (indent-tabs-mode . t) + (tab-width . 8) + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) + (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style) + (c-toggle-comment-style 1))) + (indent-tabs-mode . t) + (tab-width . 8) + (c-file-style . "GNU") + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) +) diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index 6bfd6768727..04944a17b4f 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,7 @@ +2020-03-06 Andrew Burgess + + * .dir-locals.el: New file. + 2020-03-05 Vyacheslav Petrishchev * configure.ac: Added call development.sh.