Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uncrustify space after // in wrapped command line

Tags:

c++

c

uncrustify

I use uncrustify with following parameter:

sp_cmt_cpp_start                = force         # Add space after opening '//'
cmt_width                       = 78  

Input:

bi.dwSize = sizeof (bi); //Size of the structure itself, must be initialized with sizeof(CGOSBOARDINFO)

Output:

bi.dwSize = sizeof(bi); // Size of the structure itself, must be
                              //initialized with sizeof(CGOSBOARDINFO)

But after // in the second line "//initialized" it should look like:

bi.dwSize = sizeof(bi); // Size of the structure itself, must be
                              // initialized with sizeof(CGOSBOARDINFO)

Does anyone have an idea how to fix this small problem?

like image 491
MeJ Avatar asked Oct 07 '22 17:10

MeJ


1 Answers

I've filed the issue against uncrustify. I've also got a possible fix, if you care and are able to rebuild uncrustify from source.

https://github.com/bengardner/uncrustify/issues/95

As a workaround, you can simply change force to add in your uncrustify configuration. This seems to have the right behavior, as long as your comments don't contain embedded double and triple spaces. (uncrustify's line wrapping has slightly wacky behavior when confronted with consecutive whitespace characters.)

EDIT: The bug is fixed in master, as of 2012-12-04: https://github.com/bengardner/uncrustify/commit/44e0253a

like image 106
Quuxplusone Avatar answered Oct 13 '22 03:10

Quuxplusone