Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#214 astyle breaks code containing { after \ with Java style

closed-fixed
Jim Pattee
None
7
2015-01-03
2013-04-22
Anonymous
No

With Java style the following code:
void foo () {
if (x)\ {
...
}
}
AStyle formats to :
void foo () {
if (x)\ {
...
}
}

The result is uncompilable.
Even if it's not common to have a continuation character outside a #define or multiline string, this is valid C code which is broken after formatting.

Discussion

  • It seems that when posting, the original code is also broken :) -
    if (x) \
    {
    is transformed into
    if (x) \ {

    The original code was:
    void foo ()
    {
    if (x)\
    {
    ...
    }
    }

    After formatting with Java style the open bracket after the if is put after the line continuation character('\') on the same line thus breaking the code.
    I'm attaching a possible fix - the modifications are done on 2.02.1 version

     
    Last edit: Constantin Popescu 2013-08-01
  • Jim Pattee
    Jim Pattee
    2013-10-09

    • status: open --> open-fixed
    • assigned_to: Jim Pattee
    • Group: --> 1.15.3
    • Priority: 5 --> 7
     
  • Jim Pattee
    Jim Pattee
    2013-10-09

    Fixed in SVN.

     
  • Jim Pattee
    Jim Pattee
    2013-11-05

    • status: open-fixed --> closed-fixed