Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] GNU built-in formatter corrections

Hi,

While writing code for GDB, which uses the GNU coding style, I had to make a few corrections to the GNU coding style. I might be wrong and I might be missing some things, but here are the differences I have between the corrected formatter and the built-in:

# Space before parentheses in function declarations.
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="insert"/>

# Space before parentheses in function calls.
-<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="insert"/>

# The size of a tab is actually 8 columns.
-<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="2"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="8"/>

# But you want to indent by 2 columns every time.
-<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="8"/>
+<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="2"/>

# When you have 8 spaces in a row, merge them in a tab.
-<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="mixed"/>

# When wrapping parameters in function declaration, align to the column, like this (tabs replaced by spaces to make sure it displays correctly):
# int
# order_poutine (enum size size, char *toppings_list,
#                int is_it_for_here_or_for_take_out)
#
# I suppose 16 and 18 are enum values or something, because they don't really mean anything
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>

# Same as above, but for function calls.
-<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>

Simon


Back to the top