Menu

#535 Formatting not applied with cast in function call

closed-fixed
None
2023-01-24
2020-02-07
No

Consider following piece of code:

 #include <stdio.h>

#define FMT1 "d"
#define FMTD "d"
#define FMTR "d"

int
main () {
                int a, b, p1;

               printf ("0x%"FMT1"\n", (int) p1);
         a = b;
            printf ("0x%"FMTD"\n", (int) p1);
               a = b;
          printf ("0x%"FMTR"\n", (int) p1);
         a = b;

        return 0;
}

int foo () {
}

I ran astye as follows:

% astyle --version
Artistic Style Version 3.1
% astyle --style=allman --break-blocks --pad-oper --pad-paren-out --pad-header --unpad-paren --align-pointer=middle --add-brackets --convert-tabs --break-return-type --options=none test.c

#include <stdio.h>

#define FMT1 "d"
#define FMTD "d"
#define FMTR "d"

int
main ()
{
    int a, b, p1;

    printf ("0x%"FMT1"\n", (int) p1);
    a = b;
    printf ("0x%"FMTD"\n", (int) p1);
    a = b;
    printf ("0x%"FMTR"\n", (int) p1);
         a = b;

        return 0;
}

int foo () {
}

The lines till last printf are formatted properly.
But, the last printf is causing the code below it to be unformatted.
Please fix it.

Regards,
Sulabh

Discussion

  • André Simon

    André Simon - 2022-12-07
    • summary: Formatting not applied when macro used in format specifier --> Formatting not applied with cast in function call
    • status: open --> open-accepted
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2023-01-24
    • status: open-accepted --> closed-fixed
     
  • André Simon

    André Simon - 2023-01-24

    This issue was resolved in the latest 3.2 beta release.

     

Log in to post a comment.

MongoDB Logo MongoDB