summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels De Graef <Niels.DeGraef@barco.com>2018-11-05 15:33:55 +0100
committerNiels De Graef <niels.degraef@barco.com>2019-07-11 11:17:45 +0200
commit020b8ea8ed1c2a8ccc5ed847d3a7b71cba59c5e6 (patch)
tree01bf52bf18f4118609326a4c0c7af6c4b5e409c8
parent7c8baf8ed9e430848143dd12cf766e83af9142df (diff)
downloadmutter-wip/nielsdg/uncrustify.tar.gz
CI: add uncrustify config.wip/nielsdg/uncrustify
Run in the repo's root directory with for example ``` $ uncrustify -c data/uncrustify.cfg src/**/*.c ```
-rw-r--r--data/uncrustify.cfg116
-rw-r--r--src/backends/gsm-inhibitor-flag.h5
2 files changed, 121 insertions, 0 deletions
diff --git a/data/uncrustify.cfg b/data/uncrustify.cfg
new file mode 100644
index 000000000..7c7b47bb3
--- /dev/null
+++ b/data/uncrustify.cfg
@@ -0,0 +1,116 @@
+# Enorces the code style of Mutter (based on GNU)
+
+code_width = 80
+
+# indent using tabs
+output_tab_size = 2
+indent_columns = output_tab_size
+indent_with_tabs = 0
+indent_brace = 2
+indent_braces = false
+indent_braces_no_func = True
+indent_func_call_param = false
+indent_func_def_param = false
+indent_func_proto_param = false
+indent_switch_case = 0
+indent_case_brace = 2
+indent_paren_close = 1
+
+# newlines
+newlines = lf
+nl_after_semicolon = true
+nl_start_of_file = remove
+nl_end_of_file = force
+nl_end_of_file_min = 1
+
+# spaces
+sp_return_paren = add # "return (1);" vs "return(1);"
+sp_sizeof_paren = add # "sizeof (int)" vs "sizeof(int)"
+sp_assign = add
+sp_arith = add
+sp_bool = add
+sp_compare = add
+sp_after_comma = add
+sp_case_label = add
+sp_else_brace = add
+sp_brace_else = add
+sp_func_call_paren = add # "foo (" vs "foo("
+sp_func_proto_paren = add # "int foo ();" vs "int foo();"
+sp_before_ptr_star = add
+sp_after_ptr_star_qualifier = add # "const char * const" vs. "const char *const"
+sp_after_ptr_star = remove
+sp_between_ptr_star = remove # "**var" vs "* *var"
+sp_inside_paren = remove # "( 1 )" vs "(1)"
+sp_inside_fparen = remove # "( 1 )" vs "(1)" - functions
+sp_inside_sparen = remove # "( 1 )" vs "(1)" - if/for/etc
+sp_after_cast = add # "(int) a" vs "(int)a"
+sp_func_call_user_paren = remove # For gettext, "_()" vs. "_ ()"
+set func_call_user _ N_ C_ # Needed for sp_after_cast
+sp_before_semi = remove
+sp_paren_paren = remove # Space between (( and ))
+
+eat_blanks_before_close_brace = true
+eat_blanks_after_open_brace = true
+
+# Style for curly braces
+nl_assign_brace = add
+nl_enum_brace = add
+nl_union_brace = add
+nl_struct_brace = add
+nl_class_brace = add
+nl_do_brace = add
+nl_if_brace = add
+nl_for_brace = add
+nl_else_brace = add
+nl_elseif_brace = add
+nl_while_brace = add
+nl_switch_brace = add
+nl_fcall_brace = add
+nl_fdef_brace = add
+nl_brace_else = add
+nl_brace_while = add
+nl_case_colon_brace = add
+nl_after_brace_open = true
+
+# Function calls and parameters
+nl_func_paren = remove
+nl_func_def_paren = remove
+nl_func_decl_start = remove
+nl_func_def_start = remove
+nl_func_decl_args = ignore
+nl_func_def_args = ignore
+nl_func_decl_args_multi_line = true
+nl_func_def_args_multi_line = true
+nl_func_decl_end = remove
+nl_func_def_end = remove
+
+# Code modifying options (non-whitespace)
+mod_full_brace_function = force
+mod_remove_extra_semicolon = true
+
+# Align
+align_func_params = true
+align_single_line_func = true
+align_var_def_star_style = 2
+
+# one liners
+nl_func_leave_one_liners = true
+nl_enum_leave_one_liners = true
+nl_assign_leave_one_liners = true
+
+# Comments
+cmt_cpp_to_c = true # "/* */" vs. "//"
+cmt_convert_tab_to_spaces = true
+#cmt_reflow_mode = 2 # Full reflow (seems doesn't work quite well, it doesn't reorder the comments)
+cmt_width = 80 # Line width
+cmt_star_cont = true # Whether to put a star on subsequent comment lines
+cmt_sp_after_star_cont = 1 # The number of spaces to insert after the star on subsequent comment lines
+cmt_c_nl_start = false # false/true
+cmt_c_nl_end = true # false/true
+# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
+# the comment are the same length. Default=True
+cmt_multi_check_last = false
+
+# Encoding
+utf8_bom = remove
+utf8_force = true
diff --git a/src/backends/gsm-inhibitor-flag.h b/src/backends/gsm-inhibitor-flag.h
index 40698f96a..1818a176e 100644
--- a/src/backends/gsm-inhibitor-flag.h
+++ b/src/backends/gsm-inhibitor-flag.h
@@ -23,6 +23,9 @@
G_BEGIN_DECLS
+/* This file was copied from gnome-session, so don't apply our code style */
+/* *INDENT-OFF* */
+
typedef enum {
GSM_INHIBITOR_FLAG_LOGOUT = 1 << 0,
GSM_INHIBITOR_FLAG_SWITCH_USER = 1 << 1,
@@ -31,6 +34,8 @@ typedef enum {
GSM_INHIBITOR_FLAG_AUTOMOUNT = 1 << 4
} GsmInhibitorFlag;
+/* *INDENT-ON* */
+
G_END_DECLS
#endif /* __GSM_INHIBITOR_FLAG_H__ */