|Summary:||Finer support for "pad parenthesis" setting|
|Product:||kdevelop||Reporter:||Rolf Eike Beer <kde>|
|Latest Commit:||http://commits.kde.org/kdevelop/2862a82438fbbf8129f1c56234ccb482e41ca412||Version Fixed In:|
|Attachments:||Adds option to enable/disable padding parenthesis headers.|
Description Rolf Eike Beer 2012-06-26 19:24:21 UTC
I would like to have different settings for "pad parenthesis" for "constructs" and function calls. At the end I want to be able to really configure "kernel style" which looks like this: if (foo()) int foo(void) for (i = 0; i <= 10; i++) i.e. padding is outside for for/if/while and the like, but no padding for function calls and declarations. Reproducible: Always
Comment 1 Rawk 2012-08-13 19:59:17 UTC
Created attachment 73146 [details] Adds option to enable/disable padding parenthesis headers.
Comment 2 Rawk 2012-08-13 20:10:06 UTC
The attached patch should fix the issue. It applies to version 4.3.1 and the current trunk. I think the built in code style should be rechecked, if the padding should be really "outside" or just "headers". The patch enables padding parenthesis headers by default. However one problem remains (when using Qt): "foreach" is not in astyle's headers list for C/C++. It would be simple to change the astyle code to add "foreach". Though I think it would be better to make astyle more flexible at this point... http://astyle.sourceforge.net/astyle.html#_pad-header explains padding parenthesis headers.
Comment 3 Milian Wolff 2012-08-14 10:33:27 UTC
Wow very cool, I thought astyle was simply too dump to figure this out and thought this was a wontfix. Thanks Rawk, could you please extend the patch to include "foreach" in the list of headers? And please put the patch on reviewboard.
Comment 4 Rawk 2012-08-15 07:55:20 UTC
The patch is now in reviewboard: https://git.reviewboard.kde.org/r/106032/ "foreach" is added to the list of headers and it is assured that "&" and "*" are not treated as operators at this point. Additionally the KDELibs style is fixed according to http://techbase.kde.org/Policies/Kdelibs_Coding_Style#Artistic_Style_.28astyle.29_automatic_code_formatting
Comment 5 Milian Wolff 2012-08-16 18:53:15 UTC
Git commit 2862a82438fbbf8129f1c56234ccb482e41ca412 by Milian Wolff, on behalf of Dominic Tubach. Committed on 16/08/2012 at 20:46. Pushed by mwolff into branch '4.4'. Astyle formatter: add support for padding parenthesis headers The patch adds an option to enable/disable padding parenthesis headers in the astyle code formatter. For improved Qt compatibility, "foreach" is added to the list of headers and it is assured that "&" and "*" are not treated as operators at this point. The KDELibs and Qt styles are fixed to properly use this new feature. REVIEW: 106032 M +12 -1 formatters/astyle/astyle_formatter.cpp M +1 -0 formatters/astyle/astyle_formatter.h M +15 -0 formatters/astyle/astyle_preferences.cpp M +27 -17 formatters/astyle/astyle_preferences.ui M +3 -1 formatters/astyle/lib/ASFormatter.cpp M +6 -0 formatters/astyle/lib/ASResource.cpp http://commits.kde.org/kdevelop/2862a82438fbbf8129f1c56234ccb482e41ca412