Changes between Version 11 and Version 12 of CodeStyle


Ignore:
Timestamp:
12/08/16 22:35:03 (7 years ago)
Author:
Steffan Karger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodeStyle

    v11 v12  
    8686This makes the intent immediately clear to the reader / reviewer.
    8787
    88 = GNU Indent rules =
    89 to get the above effect, use
    90 {{{
    91 gindent -kr -bl -nce -nbc -l80 file.c
    92 }}}
    93 (though other options might be needed, work in progress)
    94 
    95 Indent likes to produce artifacts, though, because it really really likes putting the return type on the same line as the function name, which creates long and messy declarations for many functions in tun.c (my test candidate).
    96 
    97 A slightly less brutal tool (because it can be told to just leave certain constructs alone, while changing others) seems to be
     88= Crustify rules =
     89The most fit tool for our purpose (because it can be told to just leave certain constructs alone, while changing others) seems to be
    9890
    9991{{{
     
    10193}}}
    10294
    103 ... but that one has a zillion of options (600)... some options for a start
     95... but it has a zillion of options (600)... our config-in-the-making:
    10496{{{
     97# Use Allman-style, space-only
    10598indent_columns=4
    106 indent_with_tabs=2
     99indent_with_tabs=0
     100align_with_tabs=false
    107101indent_braces=false
    108102indent_else_if=false
    109 indent_switch_case=2
    110 indent_label=-2
    111 sp_before_sparen=add
    112 sp_inside_sparen=remove
    113103nl_if_brace=add
    114104nl_brace_else=add
     
    116106nl_else_brace=add
    117107nl_else_if=remove
     108sp_func_proto_paren=Remove
     109sp_func_def_paren=Remove
     110sp_func_call_paren=Remove
     111
     112# Do not put spaces between the # and preprocessor statements
     113pp_space=remove
     114
     115cmt_convert_tab_to_spaces=true
     116indent_switch_case=4
     117indent_label=1
     118sp_before_sparen=add
     119sp_inside_sparen=remove
     120sp_cond_colon=add
     121sp_cond_question=add
     122sp_bool=add
     123sp_else_brace=add
     124sp_brace_else=add
     125pos_arith=Lead
    118126nl_func_type_name=add
     127nl_before_case=true
     128nl_assign_leave_one_liners=true
     129nl_enum_leave_one_liners=true
     130nl_brace_fparen=add
     131nl_max=4
     132nl_after_func_proto=2
    119133code_width=80
     134ls_code_width=false
    120135mod_full_brace_if=add
    121136mod_full_brace_if_chain=false
    122137mod_add_long_ifdef_endif_comment=20
    123 mod_add_long_ifdef_else_comment
     138mod_add_long_ifdef_else_comment=5
     139mod_remove_extra_semicolon=true
    124140cmt_c_nl_end=true
    125141cmt_star_cont=true
    126 pp_indent=add
     142
     143# Use "char **a"-style pointer stars
     144sp_before_ptr_star=Add
     145sp_between_ptr_star=Remove
     146sp_after_ptr_star=Remove
     147
    127148}}}