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

Message ID 20161201160412.GC19289@E107787-LIN
State New, archived
Headers

Commit Message

Yao Qi Dec. 1, 2016, 4:04 p.m. UTC
  On Thu, Dec 01, 2016 at 03:21:15PM +0000, Yao Qi wrote:
> On Thu, Dec 01, 2016 at 12:57:45PM +0000, Pedro Alves wrote:
> > On 12/01/2016 11:16 AM, Yao Qi wrote:
> > 
> > > +#if GDB_SELF_TEST
> > > +
> > > +namespace selftests
> > > +{
> > > +
> > > +  /* Instruction reader from manually cooked instruction sequences.  */
> > > +
> > > +  class instruction_reader_test : public abstract_instruction_reader
> > > +  {
> > 
> > This whole class should be indented at column 0.
> > 
> 
> Hi Pedro,
> That is how emacs indents my code (at column 2).  Even I start emacs
> with -q, it still indents that way.
> 

I managed to get emacs indent at column 0 with the following changes in
gdb/.dir-locals.el.
  

Comments

Pedro Alves Dec. 1, 2016, 6:05 p.m. UTC | #1
On 12/01/2016 04:04 PM, Yao Qi wrote:
> On Thu, Dec 01, 2016 at 03:21:15PM +0000, Yao Qi wrote:
>> On Thu, Dec 01, 2016 at 12:57:45PM +0000, Pedro Alves wrote:
>>> On 12/01/2016 11:16 AM, Yao Qi wrote:
>>>
>>>> +#if GDB_SELF_TEST
>>>> +
>>>> +namespace selftests
>>>> +{
>>>> +
>>>> +  /* Instruction reader from manually cooked instruction sequences.  */
>>>> +
>>>> +  class instruction_reader_test : public abstract_instruction_reader
>>>> +  {
>>>
>>> This whole class should be indented at column 0.
>>>
>>
>> Hi Pedro,
>> That is how emacs indents my code (at column 2).  Even I start emacs
>> with -q, it still indents that way.
>>
> 
> 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?

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.

(The '{'-on-same-line rule is there too.)

Thanks,
Pedro Alves
  

Patch

--- a/gdb/.dir-locals.el
+++ b/gdb/.dir-locals.el
@@ -19,6 +19,12 @@ 
              (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")
-           (indent-tabs-mode . t)))
+ (c-mode . (
+           (c-file-style . "GNU")
+           (mode . c++)
+           (indent-tabs-mode . t)
+           (c-offsets-alist . (
+                               (innamespace . 0)
+                               ))
+           ))
 )