diff options
author | Simon Marchi | 2013-06-28 18:01:57 +0000 |
---|---|---|
committer | Marc-Andre Laperle | 2013-07-02 21:40:02 +0000 |
commit | 5aed22487a205ccdce25ff75a5830fafee56a3bb (patch) | |
tree | 6f3272d3aa2627609bda3efbdd451b431cc59a58 | |
parent | 98bc8813e78d9793cbfb4351711ed9b47b6f4252 (diff) | |
download | org.eclipse.cdt-5aed22487a205ccdce25ff75a5830fafee56a3bb.tar.gz org.eclipse.cdt-5aed22487a205ccdce25ff75a5830fafee56a3bb.tar.xz org.eclipse.cdt-5aed22487a205ccdce25ff75a5830fafee56a3bb.zip |
Bug 411911 - Fix some GNU formatter defaults
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Change-Id: Idf974c14be894dffecb3e48938732fbd9f227cea
Reviewed-on: https://git.eclipse.org/r/14144
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
IP-Clean: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
2 files changed, 17 insertions, 12 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java index a62816e1ee7..08266d3f276 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation * Sergey Prigogin (Google) * Anton Leherbauer (Wind River Systems) + * Simon Marchi (Ericsson) - GNU formatter fixes *******************************************************************************/ package org.eclipse.cdt.core.formatter; @@ -1813,8 +1814,10 @@ public class DefaultCodeFormatterOptions { this.indent_breaks_compare_to_cases = true; this.indent_empty_lines = false; this.indent_switchstatements_compare_to_cases = true; - this.indent_switchstatements_compare_to_switch = false; - this.indentation_size = 8; + this.indent_switchstatements_compare_to_switch = true; + this.indentation_size = 2; + this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN; + this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT | Alignment.M_INDENT_ON_COLUMN; this.insert_new_line_after_opening_brace_in_initializer_list = false; this.insert_new_line_after_template_declaration = true; @@ -1830,6 +1833,8 @@ public class DefaultCodeFormatterOptions { // this.insert_new_line_in_empty_type_declaration = false; this.insert_space_before_colon_in_base_clause = true; + this.insert_space_before_opening_paren_in_method_declaration = true; + this.insert_space_before_opening_paren_in_method_invocation = true; this.compact_else_if = true; this.keep_guardian_clause_on_one_line = false; @@ -1838,9 +1843,9 @@ public class DefaultCodeFormatterOptions { this.keep_simple_if_on_one_line = false; this.keep_then_statement_on_same_line = false; this.put_empty_statement_on_new_line = true; - this.tab_size = 2; + this.tab_size = 8; this.page_width = 80; - this.tab_char = SPACE; + this.tab_char = MIXED; this.use_tabs_only_for_leading_indentations = false; } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index f1032773097..b7786cb6cb7 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -723,7 +723,7 @@ public class CodeFormatterTest extends BaseUITestCase { //}; //int - //foo() + //foo () //{ // try // { @@ -733,7 +733,7 @@ public class CodeFormatterTest extends BaseUITestCase { // } //} //float* - //bar(); + //bar (); //template<typename _CharT, typename _Traits> // class basic_ios : public ios_base // { @@ -1656,7 +1656,7 @@ public class CodeFormatterTest extends BaseUITestCase { //#define FOREVER for(;;) // //void - //foo() + //foo () //{ // int i = 0; // if (true) @@ -1672,8 +1672,8 @@ public class CodeFormatterTest extends BaseUITestCase { // BLOCK // switch (i) // { - // case 0: - // BLOCK + // case 0: + // BLOCK // } //} public void testCompoundStatementAsMacroGNU_Bug244928() throws Exception { @@ -2764,13 +2764,13 @@ public class CodeFormatterTest extends BaseUITestCase { //} //void - //foo() + //foo () //{ // int i; // for (i = 0; i < 10; i++) // { // } - // foo(); + // foo (); //} public void testForLoopGNU_Bug351399() throws Exception { fOptions.putAll(DefaultCodeFormatterOptions.getGNUSettings().getMap()); |