Skip to content

Commit d41332a

Browse files
author
Daniel Kroening
authored
Merge pull request #497 from thk123/refactor/coding-standards-makefile-program-flags
Extended the coding standard
2 parents 0a30db8 + 4031a0a commit d41332a

File tree

29 files changed

+837
-316
lines changed

29 files changed

+837
-316
lines changed

CODING_STANDARD

+39
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,35 @@ Header files:
9292
of the header file rather than in line
9393
- Guard headers with #ifndef CPROVER_DIRECTORIES_FILE_H, etc
9494

95+
Make files
96+
- Each source file should appear on a separate line
97+
- The final source file should still be followed by a trailing slash
98+
- The last line should be a comment to not be deleted, i.e. should look like:
99+
```
100+
SRC = source_file.cpp \
101+
source_file2.cpp \
102+
# Empty last line
103+
```
104+
- This ensures the Makefiles can be easily merged.
105+
106+
Program Command Line Options
107+
- Each program contains a program_name_parse_optionst class which should
108+
contain a define PROGRAM_NAME_PARSE_OPTIONS which is a string of all the
109+
parse options in brackets (with a colon after the bracket if it takes a
110+
parameter)
111+
- Each parameter should be one per line to yield easy merging
112+
- If parameters are shared between programs, they should be pulled out into
113+
a common file and then included using a define
114+
- The defines should be OPT_FLAG_NAMES which should go into the OPTIONS define
115+
- The defines should include HELP_FLAG_NAMES which should contain the help
116+
output of the format:
117+
```
118+
" --flag explanations\n" \
119+
" --another flag more explanation\n" \
120+
<-------30 chars------>
121+
- The defines may include PARSE_OPTIONS_FLAG_NAMES which move the options
122+
from the command line into the options
123+
95124
C++ features:
96125
- Do not use namespaces.
97126
- Prefer use of 'typedef' insted of 'using'.
@@ -143,3 +172,13 @@ Output:
143172
- Use '\n' instead of std::endl
144173

145174
You are allowed to break rules if you have a good reason to do so.
175+
176+
Pre-commit hook to run cpplint locally
177+
--------------------------------------
178+
To install the hook
179+
cp .githooks/pre-commit .git/hooks/pre-commit
180+
or use a symbolic link.
181+
Then, when running git commit, you should get the linter output
182+
(if any) before being prompted to enter a commit message.
183+
To bypass the check (e.g. if there was a false positive),
184+
add the option --no-verify.

src/analyses/Makefile

+26-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1-
SRC = natural_loops.cpp is_threaded.cpp dirty.cpp interval_analysis.cpp \
2-
invariant_set.cpp invariant_set_domain.cpp invariant_propagation.cpp \
3-
static_analysis.cpp uninitialized_domain.cpp local_may_alias.cpp \
4-
locals.cpp goto_check.cpp call_graph.cpp interval_domain.cpp \
5-
goto_rw.cpp reaching_definitions.cpp ai.cpp local_cfg.cpp \
6-
local_bitvector_analysis.cpp dependence_graph.cpp \
7-
constant_propagator.cpp replace_symbol_ext.cpp \
8-
flow_insensitive_analysis.cpp \
9-
custom_bitvector_analysis.cpp escape_analysis.cpp global_may_alias.cpp \
1+
SRC = ai.cpp \
2+
call_graph.cpp \
3+
constant_propagator.cpp \
4+
custom_bitvector_analysis.cpp \
5+
dependence_graph.cpp \
6+
dirty.cpp \
107
does_remove_const.cpp \
8+
escape_analysis.cpp \
9+
flow_insensitive_analysis.cpp \
10+
global_may_alias.cpp \
11+
goto_check.cpp \
12+
goto_rw.cpp \
13+
interval_analysis.cpp \
14+
interval_domain.cpp \
15+
invariant_propagation.cpp \
16+
invariant_set.cpp \
17+
invariant_set_domain.cpp \
18+
is_threaded.cpp \
19+
local_bitvector_analysis.cpp \
20+
local_cfg.cpp \
21+
local_may_alias.cpp \
22+
locals.cpp \
23+
natural_loops.cpp \
24+
reaching_definitions.cpp \
25+
replace_symbol_ext.cpp \
26+
static_analysis.cpp \
27+
uninitialized_domain.cpp \
1128
# Empty last line
1229

1330
INCLUDES= -I ..

src/ansi-c/Makefile

+39-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
1-
SRC = c_typecast.cpp ansi_c_y.tab.cpp ansi_c_lex.yy.cpp ansi_c_parser.cpp \
2-
expr2c.cpp ansi_c_language.cpp c_sizeof.cpp ansi_c_scope.cpp \
3-
c_types.cpp ansi_c_typecheck.cpp \
4-
c_preprocess.cpp c_storage_spec.cpp \
5-
c_typecheck_base.cpp c_typecheck_initializer.cpp \
6-
c_typecheck_typecast.cpp c_typecheck_code.cpp \
7-
c_typecheck_expr.cpp c_typecheck_type.cpp string_constant.cpp \
8-
c_qualifiers.cpp c_typecheck_argc_argv.cpp ansi_c_parse_tree.cpp \
9-
preprocessor_line.cpp ansi_c_convert_type.cpp \
10-
type2name.cpp cprover_library.cpp anonymous_member.cpp \
11-
printf_formatter.cpp ansi_c_internal_additions.cpp padding.cpp \
12-
ansi_c_declaration.cpp designator.cpp ansi_c_entry_point.cpp \
13-
literals/parse_float.cpp literals/unescape_string.cpp \
14-
literals/convert_float_literal.cpp \
1+
SRC = anonymous_member.cpp \
2+
ansi_c_convert_type.cpp \
3+
ansi_c_declaration.cpp \
4+
ansi_c_entry_point.cpp \
5+
ansi_c_internal_additions.cpp \
6+
ansi_c_language.cpp \
7+
ansi_c_lex.yy.cpp \
8+
ansi_c_parse_tree.cpp \
9+
ansi_c_parser.cpp \
10+
ansi_c_scope.cpp \
11+
ansi_c_typecheck.cpp \
12+
ansi_c_y.tab.cpp \
13+
c_misc.cpp \
14+
c_preprocess.cpp \
15+
c_qualifiers.cpp \
16+
c_sizeof.cpp \
17+
c_storage_spec.cpp \
18+
c_typecast.cpp \
19+
c_typecheck_argc_argv.cpp \
20+
c_typecheck_base.cpp \
21+
c_typecheck_code.cpp \
22+
c_typecheck_expr.cpp \
23+
c_typecheck_initializer.cpp \
24+
c_typecheck_type.cpp \
25+
c_typecheck_typecast.cpp \
26+
c_types.cpp \
27+
cprover_library.cpp \
28+
designator.cpp \
29+
expr2c.cpp \
1530
literals/convert_character_literal.cpp \
31+
literals/convert_float_literal.cpp \
1632
literals/convert_integer_literal.cpp \
17-
literals/convert_string_literal.cpp c_misc.cpp
33+
literals/convert_string_literal.cpp \
34+
literals/parse_float.cpp \
35+
literals/unescape_string.cpp \
36+
padding.cpp \
37+
preprocessor_line.cpp \
38+
printf_formatter.cpp \
39+
string_constant.cpp \
40+
type2name.cpp \
41+
# Empty last line
1842

1943
INCLUDES= -I ..
2044

src/assembler/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
SRC = assembler_lex.yy.cpp assembler_parser.cpp
2-
1+
SRC = assembler_lex.yy.cpp \
2+
assembler_parser.cpp \
3+
# Empty last line
34
INCLUDES= -I ..
45

56
include ../config.inc

src/cbmc/Makefile

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
SRC = cbmc_main.cpp cbmc_parse_options.cpp bmc.cpp cbmc_dimacs.cpp \
2-
cbmc_languages.cpp counterexample_beautification.cpp \
3-
bv_cbmc.cpp symex_bmc.cpp show_vcc.cpp cbmc_solvers.cpp \
4-
xml_interface.cpp bmc_cover.cpp all_properties.cpp \
5-
fault_localization.cpp symex_coverage.cpp
1+
SRC = all_properties.cpp \
2+
bmc.cpp \
3+
bmc_cover.cpp \
4+
bv_cbmc.cpp \
5+
cbmc_dimacs.cpp \
6+
cbmc_languages.cpp \
7+
cbmc_main.cpp \
8+
cbmc_parse_options.cpp \
9+
cbmc_solvers.cpp \
10+
counterexample_beautification.cpp \
11+
fault_localization.cpp \
12+
show_vcc.cpp \
13+
symex_bmc.cpp \
14+
symex_coverage.cpp \
15+
xml_interface.cpp \
16+
# Empty last line
617

718
OBJ += ../ansi-c/ansi-c$(LIBEXT) \
819
../cpp/cpp$(LIBEXT) \

0 commit comments

Comments
 (0)