[PATCH 1/2 v2] Add unit test to aarch64 prologue analyzer

Pedro Alves palves@redhat.com
Fri Dec 2 11:11:00 GMT 2016


On 12/02/2016 09:40 AM, Yao Qi wrote:
> On Thu, Dec 01, 2016 at 06:05:30PM +0000, Pedro Alves wrote:
>>>
>>> I managed to get emacs indent at column 0 with the following changes in
>>> gdb/.dir-locals.el.
>>
>> That unfortunately somehow makes emacs indent members of classes
>> (even if not in a namespace) at column 0, like:
>>
>> struct foo
>> {
>> int a;
>> };
>>
>> Do you get that too?
>>
> 
> Yes, :(
> 
>> BTW, the don't-indent-body-of-namespace guideline is here:
>>
>>   https://gcc.gnu.org/codingconventions.html#Namespace_Form
>>
>> and it does look like GCC generally follows it.
> 
> I still can't get me emacs indent code inside namespace that way, but
> I manually fixed it.  I'll ask gcc people how do they set emacs.

I have a custom c-mode on my ~/.emacs (predating gdb/.dir-locals.el),
and adding the namespace tweak there works correctly.  Eh.
Like this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(defun gdb-c-mode ()
  "C mode with adjusted defaults for use with GDB."
  (interactive)
  (c++-mode)
  (c-set-style "gnu")
  (setq tab-width 8)
  (setq indent-tabs-mode 1)
  (setq c-basic-offset 2)
  (c-set-offset 'innamespace 0)
  )
(setq auto-mode-alist (cons '(".*/gdb.*/.*\\.[ch]$" . gdb-c-mode)
			    auto-mode-alist))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So if .dir-locals.el can't work for some reason, we could put
something like that in gdb/gdb-code-style.el.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list