mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Add uncrustify config file for new sudo code style.
This commit is contained in:
parent
3a0445af9c
commit
60328e5c7e
13
Makefile.in
13
Makefile.in
@ -1,7 +1,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: ISC
|
||||
#
|
||||
# Copyright (c) 2010-2015, 2017-2018 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
# Copyright (c) 2010-2015, 2017-2019 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
@ -108,6 +108,15 @@ check pre-install: config.status
|
||||
exit $$?; \
|
||||
done
|
||||
|
||||
uncrustify.files: Makefile
|
||||
grep '\.[ch]$$' $(top_srcdir)/MANIFEST | egrep -v '(/zlib/|/(arc4random|arc4random_uniform|chacha_private|charclass|fnmatch|getaddrinfo|getcwd|getdate|getentropy|getopt|getopt_long|glob|gram|inet_ntop|inet_pton|log_server.pb-c|mktemp|pw_dup|reallocarray|mktemp_test|protobuf-c|snprintf|stdbool|strlcat|strlcpy|sudo_queue|toke)\.[ch]$$)' > uncrustify.files
|
||||
|
||||
reformat: uncrustify.files
|
||||
( cd $(top_srcdir) && uncrustify -c etc/uncrustify.cfg --replace --no-backup -F $(top_builddir)/uncrustify.files )
|
||||
|
||||
check-format: uncrustify.files
|
||||
( cd $(top_srcdir) && uncrustify -c etc/uncrustify.cfg --check -F $(top_builddir)/uncrustify.files )
|
||||
|
||||
cppcheck: config.status
|
||||
rval=0; \
|
||||
for d in $(SUBDIRS); do \
|
||||
@ -407,4 +416,4 @@ sandwich:
|
||||
echo "What? Make it yourself!"; \
|
||||
fi
|
||||
|
||||
.PHONY: ChangeLog me a sandwhich
|
||||
.PHONY: ChangeLog me a sandwhich check-format reformat
|
||||
|
346
etc/uncrustify-small.cfg
Normal file
346
etc/uncrustify-small.cfg
Normal file
@ -0,0 +1,346 @@
|
||||
# Uncrustify-0.70.1
|
||||
|
||||
#
|
||||
# Sudo coding style changes to override uncrustify defaults
|
||||
#
|
||||
|
||||
# The type of line endings.
|
||||
#
|
||||
# Default: auto
|
||||
newlines = lf # lf/crlf/cr/auto
|
||||
|
||||
# Add or remove space around assignment operator '=', '+=', etc.
|
||||
sp_assign = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after preprocessor '#' stringify operator.
|
||||
# Also affects the '#@' charizing operator.
|
||||
sp_pp_stringify = add # ignore/add/remove/force
|
||||
|
||||
# Add or remove space around boolean operators '&&' and '||'.
|
||||
sp_bool = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space around compare operator '<', '>', '==', etc.
|
||||
sp_compare = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside '(' and ')'.
|
||||
sp_inside_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between nested parentheses, i.e. '((' vs. ') )'.
|
||||
sp_paren_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space before pointer star '*'.
|
||||
sp_before_ptr_star = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between pointer stars '*'.
|
||||
sp_between_ptr_star = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after pointer star '*', if followed by a word.
|
||||
#
|
||||
# Overrides sp_type_func.
|
||||
sp_after_ptr_star = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space before a reference sign '&'.
|
||||
sp_before_byref = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after reference sign '&', if followed by a word.
|
||||
#
|
||||
# Overrides sp_type_func.
|
||||
sp_after_byref = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space before '<'.
|
||||
sp_before_angle = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside '<' and '>'.
|
||||
sp_inside_angle = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after '>'.
|
||||
sp_after_angle = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space before '(' of control statements ('if', 'for', 'switch',
|
||||
# 'while', etc.).
|
||||
sp_before_sparen = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside '(' and ')' of control statements.
|
||||
sp_inside_sparen = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after ')' of control statements.
|
||||
sp_after_sparen = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between ')' and '{' of of control statements.
|
||||
sp_sparen_brace = add # ignore/add/remove/force
|
||||
|
||||
# Add or remove space before a semicolon of an empty part of a for statement.
|
||||
sp_before_semi_for_empty = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside a non-empty '[' and ']'.
|
||||
sp_inside_square = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after ',', i.e. 'a,b' vs. 'a, b'.
|
||||
sp_after_comma = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after C/D cast, i.e. 'cast(int)a' vs. 'cast(int) a' or
|
||||
# '(int)a' vs. '(int) a'.
|
||||
sp_after_cast = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between 'sizeof' and '('.
|
||||
sp_sizeof_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside enum '{' and '}'.
|
||||
sp_inside_braces_enum = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside struct/union '{' and '}'.
|
||||
sp_inside_braces_struct = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside '{' and '}'.
|
||||
sp_inside_braces = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between return type and function name. A minimum of 1
|
||||
# is forced except for pointer return types.
|
||||
sp_type_func = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between function name and '(' on function declaration.
|
||||
sp_func_proto_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between alias name and '(' of a non-pointer function type typedef.
|
||||
sp_func_def_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space inside empty function '()'.
|
||||
# Overrides sp_after_angle unless use_sp_after_angle_always is set to true.
|
||||
sp_inside_fparens = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between ')' and '{' of function.
|
||||
sp_fparen_brace = add # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between function name and '(' on function calls.
|
||||
sp_func_call_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between 'else' and '{' if on the same line.
|
||||
sp_else_brace = add # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between '}' and 'else' if on the same line.
|
||||
sp_brace_else = add # ignore/add/remove/force
|
||||
|
||||
# Add or remove space between '}' and the name of a typedef on the same line.
|
||||
sp_brace_typedef = force # ignore/add/remove/force
|
||||
|
||||
# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make
|
||||
# sense here.
|
||||
sp_case_label = force # ignore/add/remove/force
|
||||
|
||||
# The number of columns to indent per level. Usually 2, 3, 4, or 8.
|
||||
#
|
||||
# Default: 8
|
||||
indent_columns = 4 # unsigned number
|
||||
|
||||
# The continuation indent. If non-zero, this overrides the indent of '(', '['
|
||||
# and '=' continuation indents. Negative values are OK; negative value is
|
||||
# absolute and not increased for each '(' or '[' level.
|
||||
indent_continue = 8 # number
|
||||
|
||||
# How to use tabs when indenting code.
|
||||
#
|
||||
# 0: Spaces only
|
||||
# 1: Indent with tabs to brace level, align with spaces (default)
|
||||
# 2: Indent and align with tabs, using spaces when not on a tabstop
|
||||
#
|
||||
# Default: 1
|
||||
indent_with_tabs = 0 # unsigned number
|
||||
|
||||
# How to indent goto labels.
|
||||
#
|
||||
# >0: Absolute column where 1 is the leftmost column
|
||||
# <=0: Subtract from brace indent
|
||||
#
|
||||
# Default: 1
|
||||
indent_label = -4 # number
|
||||
|
||||
# Don't split one-line braced assignments, as in 'foo_t f = { 1, 2 };'.
|
||||
nl_assign_leave_one_liners = true # true/false
|
||||
|
||||
# Add or remove newlines at the start of the file.
|
||||
nl_start_of_file = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline at the end of the file.
|
||||
nl_end_of_file = force # ignore/add/remove/force
|
||||
|
||||
# The minimum number of newlines at the end of the file (only used if
|
||||
# nl_end_of_file is 'add' or 'force').
|
||||
nl_end_of_file_min = 1 # unsigned number
|
||||
|
||||
# Add or remove newline between 'enum' and '{'.
|
||||
nl_enum_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'struct and '{'.
|
||||
nl_struct_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'union' and '{'.
|
||||
nl_union_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'if' and '{'.
|
||||
nl_if_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between '}' and 'else'.
|
||||
nl_brace_else = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'else' and '{'.
|
||||
nl_else_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'else' and 'if'.
|
||||
nl_else_if = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline before 'if'/'else if' closing parenthesis.
|
||||
nl_before_if_closing_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'for' and '{'.
|
||||
nl_for_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'while' and '{'.
|
||||
nl_while_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'do' and '{'.
|
||||
nl_do_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between '}' and 'while' of 'do' statement.
|
||||
nl_brace_while = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between 'switch' and '{'.
|
||||
nl_switch_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between return type and function name in a function
|
||||
# definition.
|
||||
# might be modified by nl_func_leave_one_liners
|
||||
nl_func_type_name = force # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between return type and function name in a prototype.
|
||||
nl_func_proto_type_name = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between a function name and the opening '(' in the
|
||||
# declaration.
|
||||
nl_func_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between a function name and the opening '(' in the
|
||||
# definition.
|
||||
nl_func_def_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between a function name and the opening '(' in the
|
||||
# call.
|
||||
nl_func_call_paren = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline after '(' in a function declaration.
|
||||
nl_func_decl_start = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline after '(' in a function definition.
|
||||
nl_func_def_start = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove newline between function signature and '{'.
|
||||
nl_fdef_brace = add # ignore/add/remove/force
|
||||
|
||||
# Whether to add a newline after '{'. This also adds a newline before the
|
||||
# matching '}'.
|
||||
nl_after_brace_open = true # true/false
|
||||
|
||||
# Add or remove newline between the close brace and identifier,
|
||||
# as in 'struct { int a; } <here> b;'. Affects enumerations, unions and
|
||||
# structures. If set to ignore, uses nl_after_brace_close.
|
||||
nl_brace_struct_var = remove # ignore/add/remove/force
|
||||
|
||||
# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and
|
||||
# '#endif'. Does not affect top-level #ifdefs.
|
||||
nl_squeeze_ifdef = true # true/false
|
||||
|
||||
# The maximum number of consecutive newlines (3 = 2 blank lines).
|
||||
nl_max = 3 # unsigned number
|
||||
|
||||
# The number of newlines between a function definition and the function
|
||||
# comment, as in '// comment\n <here> void foo() {...}'.
|
||||
#
|
||||
# 0: No change (default).
|
||||
nl_comment_func_def = 1 # unsigned number
|
||||
|
||||
# Whether to remove blank lines after '{'.
|
||||
eat_blanks_after_open_brace = true # true/false
|
||||
|
||||
# Whether to remove blank lines before '}'.
|
||||
eat_blanks_before_close_brace = true # true/false
|
||||
|
||||
# The position of Boolean operators in wrapped expressions.
|
||||
pos_bool = trail # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force
|
||||
|
||||
# How to consider (or treat) the '*' in the alignment of variable definitions.
|
||||
#
|
||||
# 0: Part of the type 'void * foo;' (default)
|
||||
# 1: Part of the variable 'void *foo;'
|
||||
# 2: Dangling 'void *foo;'
|
||||
# Dangling: the '*' will not be taken into account when aligning.
|
||||
align_var_def_star_style = 1 # unsigned number
|
||||
|
||||
# How to consider (or treat) the '*' in the alignment of typedefs.
|
||||
#
|
||||
# 0: Part of the typedef type, 'typedef int * pint;' (default)
|
||||
# 1: Part of type name: 'typedef int *pint;'
|
||||
# 2: Dangling: 'typedef int *pint;'
|
||||
# Dangling: the '*' will not be taken into account when aligning.
|
||||
align_typedef_star_style = 1 # unsigned number
|
||||
|
||||
# Whether to align macros wrapped with a backslash and a newline. This will
|
||||
# not work right if the macro contains a multi-line comment.
|
||||
align_nl_cont = true # true/false
|
||||
|
||||
# Whether to convert all tabs to spaces in comments. If false, tabs in
|
||||
# comments are left alone, unless used for indenting.
|
||||
cmt_convert_tab_to_spaces = true # true/false
|
||||
|
||||
# Whether to put a star on subsequent comment lines.
|
||||
cmt_star_cont = true # true/false
|
||||
|
||||
# The number of spaces to insert after the star on subsequent comment lines.
|
||||
cmt_sp_after_star_cont = 3 # unsigned number
|
||||
|
||||
# Add or remove braces on a single-line 'do' statement.
|
||||
mod_full_brace_do = add # ignore/add/remove/force
|
||||
|
||||
# Whether to prevent removal of braces from 'if'/'for'/'while'/etc. blocks
|
||||
# which span multiple lines.
|
||||
#
|
||||
# Affects:
|
||||
# mod_full_brace_for
|
||||
# mod_full_brace_if
|
||||
# mod_full_brace_if_chain
|
||||
# mod_full_brace_if_chain_only
|
||||
# mod_full_brace_while
|
||||
# mod_full_brace_using
|
||||
#
|
||||
# Does not affect:
|
||||
# mod_full_brace_do
|
||||
# mod_full_brace_function
|
||||
mod_full_brace_nl_block_rem_mlcond = true # true/false
|
||||
|
||||
# Add or remove unnecessary parenthesis on 'return' statement.
|
||||
mod_paren_on_return = remove # ignore/add/remove/force
|
||||
|
||||
# Whether to remove superfluous semicolons.
|
||||
mod_remove_extra_semicolon = true # true/false
|
||||
|
||||
# Add or remove braces around a fully braced case statement. Will only remove
|
||||
# braces if there are no variable declarations in the block.
|
||||
mod_case_brace = remove # ignore/add/remove/force
|
||||
|
||||
# Whether to remove a void 'return;' that appears as the last statement in a
|
||||
# function.
|
||||
mod_remove_empty_return = true # true/false
|
||||
|
||||
# Add or remove the comma after the last value of an enumeration.
|
||||
mod_enum_last_comma = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove indentation of preprocessor directives inside #if blocks
|
||||
# at brace level 0 (file-level).
|
||||
pp_indent = remove # ignore/add/remove/force
|
||||
|
||||
# Add or remove space after # based on pp_level of #if blocks.
|
||||
pp_space = force # ignore/add/remove/force
|
||||
|
||||
# Sets the number of spaces per level added with pp_space.
|
||||
pp_space_count = 1 # unsigned number
|
||||
|
||||
# Whether to ignore the '#define' body while formatting.
|
||||
pp_ignore_define_body = true # true/false
|
2991
etc/uncrustify.cfg
Normal file
2991
etc/uncrustify.cfg
Normal file
File diff suppressed because it is too large
Load Diff
36
indent.pro
36
indent.pro
@ -1,36 +0,0 @@
|
||||
-br
|
||||
-cdb
|
||||
-ce
|
||||
-d0
|
||||
-di1
|
||||
-ei
|
||||
-i4
|
||||
-nlp
|
||||
-npcs
|
||||
-npsl
|
||||
-ps
|
||||
-sc
|
||||
-TYYSTYPE
|
||||
-TLIST
|
||||
-TLINK
|
||||
-Tu_char
|
||||
-Tu_short
|
||||
-Tu_int
|
||||
-Tu_long
|
||||
-Tushort
|
||||
-Tuint
|
||||
-Tdaddr_t
|
||||
-Tcaddr_t
|
||||
-Tino_t
|
||||
-Tswblk_t
|
||||
-Tsize_t
|
||||
-Ttime_t
|
||||
-Tdev_t
|
||||
-Toff_t
|
||||
-Tuid_t
|
||||
-Tgid_t
|
||||
-Tfixpt_t
|
||||
-Tkey_t
|
||||
-Tpaddr_t
|
||||
-Tfd_mask
|
||||
-Tfd_set
|
Loading…
x
Reference in New Issue
Block a user