#252 Astyle 2.0.4 adds extra curly brace at end of file

closed-fixed
None
7
2015-01-03
2013-11-18
Andreas
No

When the input C code file ends with a curley bracket NOT followed by a new line character then astyle 2.0.4 adds an additional faulty curly bracket at the end of the file. This did not occur with astyle 2.0.3.

Example:
Using the following command:

astyle.exe --style=ansi --lineend=linux -s3 -K -Y -f -p -H -U -xe -c < test.c

On the following file contents of test.c:

static uint8 b = 0;
void test(uint8_t a)
{if(a==1){b++;}}

(note there is no new line after the last '}')

Output using astyle 2.0.4:

static uint8 b = 0;
void test(uint8_t a)
{
   if (a == 1)
   {
      b++;
   }
}
}

Output using astyle 2.0.3:

static uint8 b = 0;
void test(uint8_t a)
{
   if (a == 1)
   {
      b++;
   }
}

Note: If the input file ends with a new line character then the formatting is correct.

Discussion

  • Jim Pattee

    Jim Pattee - 2013-11-25
    • status: open --> open-fixed
    • assigned_to: Jim Pattee
    • Priority: 5 --> 7
     
  • Jim Pattee

    Jim Pattee - 2013-11-25

    Fixed in SVN.

     
  • Jim Pattee

    Jim Pattee - 2014-11-20
    • Status: open-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks