510b54033a
code_clean: support passing in multiple edit arguments at once
...
Convenient for applying multiple common edits at once.
The '--edit' argument has been renamed to '--edits'.
2023-02-08 12:32:19 +11:00
fc85c7088c
code_clean: add 'use_nullptr' edit operation
...
Also correct doc-string for use_brief_types.
2023-02-06 12:45:49 +11:00
1567187c76
code_clean: avoid many redundant checks for use_function_style_cast
2023-01-11 23:10:10 +11:00
de5fc13c7c
Cleanup: replace pool.map with starmap
...
Avoid the need to unpack a single argument.
2022-12-08 14:04:38 +11:00
b019396613
code_clean: support commands with a "cd {directory} &&" prefix
...
Recently generated Makefiles have been including a "cd .." prefix
command that broke the code-clean utility.
Extract the CWD from the command and take it into account when
building object files.
2022-12-08 14:02:37 +11:00
6bef895313
code_clean: add unused_arg_as_comment edit generator
2022-10-12 10:41:22 +11:00
d35b4ed093
code_clean: convert an error to a warning when output can't be created
2022-10-03 11:55:33 +11:00
2ab59df2c9
code_clean: add support for running edits in multiple passes
...
When an edit cannot be applied because it overlaps one that did,
re-run all edits again until no edits could be applied or the document
reaches a previously visited state (unlikely but possible in theory).
2022-09-26 17:22:17 +10:00
e4062ff43e
code_clean: don't run with WITH_UNITY_BUILD/WITH_COMPILER_CCACHE
...
- Unity build prevents the resulting object files from being extracted.
- Compiler cache adds unnecessary overhead (and cache) for trial edits.
2022-09-26 15:32:33 +10:00
f6db2e6101
Cleanup: remove commented code, formatting tweaks
2022-09-26 15:23:54 +10:00
a288bfa305
code_clean: add use_function_style_cast edit generator
...
This moves C++ code from C style casts to function call style casts.
2022-09-26 15:20:50 +10:00
146916b413
code_clean: add use_brief_types edit generator
...
Replace `unsigned int` with `uint` and similar.
2022-09-26 14:44:52 +10:00
6f6e0332e2
code_clean: support removing redundant parenthesis arund function calls
...
'parenthesis_cleanup' cleanup pass now supports replacing
`(func(a + b))` with `func(a + b)`.
This was useful when cleaning up casts `((int)value)` which then got
converted to `(int(value))` which adds unnecessary braces in most cases.
2022-09-26 14:43:44 +10:00
5836f21ae9
code_clean: don't attempt overlapping edits
...
Support for running multiple edit-passes is needed to ensure all
overlapping edits can be applied.
2022-09-26 14:15:57 +10:00
61037c23ed
code_clean: add parenthesis_cleanup
2022-09-24 00:40:37 +10:00
8bb3c5189d
Cleanup: remove redundant parenthesis from assert
...
autopep8 v1.7 added a space after assert,
remove the parenthesis as they aren't needed.
2022-09-15 12:13:16 +10:00
405373b86f
Cleanup: remove <pep8 compliant> comment
...
This is no longer necessary, see: T98554.
2022-06-03 12:09:40 +10:00
692e233292
File headers: use SPDX license identifiers
...
See T95597
2022-02-11 16:14:41 +11:00
7c5acb95df
code_clean: fix regex matching an ambiguous number of brackets
...
`use_elem_macro` and `use_str_elem_macro` were matching all brackets,
this caused them to match unbalanced number of brackets,
creating invalid syntax.
2021-10-20 12:34:37 +11:00
5fdcb9fed4
code_clean: support for using const-casts
2021-05-18 14:22:15 +10:00
7e3892bb6b
code_clean: cleanup unused variables
2021-04-12 11:42:39 +10:00
903bad8a95
code_clean: use type hints
...
'mypy --strict' runs without errors, exposed 3x bugs.
2021-04-11 14:40:18 +10:00
c357d5b75a
Fix bugs in code_clean: utility
...
- Fix when running with 'make'.
- Add missing 'time' import.
- Correct return arguments passed to sys.exit(..).
2021-04-11 14:14:50 +10:00
f067d32f4e
Cleanup: spelling
2021-02-25 16:36:32 +11:00
42a86b0586
Cleanup: use the assignment operator with list-comprehension
2021-02-12 15:28:29 +11:00
4d28fe271e
Cleanup: spelling
2021-02-09 20:33:29 +11:00
0bf6236471
code_clean: rewrite header_clean.py, make it part of code_clean.py
2021-02-09 12:43:31 +11:00
5e2423d81b
code_clean: use named tuple to store edits, add option build args
...
This allows edits to add additional build arguments
for the compiler to use.
2021-02-09 12:42:25 +11:00
e303a3642d
code_clean: quiet each edit test by default
...
This was too noisy, and not so helpful.
2021-02-09 11:32:18 +11:00
41e893582d
code_clean: include each edit types doc-string in the --help message
2021-02-09 11:26:50 +11:00
cdb82b1555
code_clean: rename shared data argument
2021-02-09 10:50:45 +11:00
3f8b3cfa3d
code_clean: skip operating on generated source files
...
This caused cleaning to fail on generated source files.
2021-02-06 18:56:03 +11:00
ed927886c3
code_clean: move edits to a class, support setup/teardown functions
2021-02-06 11:39:16 +11:00
485f81927f
Fix 'code_clean' error in ELEM, STR_ELEM
...
These macros were being added into assert statements when testing with
release builds when they shouldn't have been.
2020-11-09 18:06:04 +11:00
7f289435f4
code_clean: add 'use_str_elem_macro' edit
2020-11-06 18:12:07 +11:00
8bbfbf0d0e
Cleanup: unused import, variable name
2020-11-06 15:43:26 +11:00
742f0a22d6
code_clean: add 'use_elem_macro' edit
2020-11-06 13:00:55 +11:00
a2a502d25d
Remove prints from last commit
2020-11-06 11:39:41 +11:00
5d2d2d26cd
code_clean: add 'use_zero_before_float_suffix' edit
2020-11-06 11:34:58 +11:00
f4aa2de034
Cleanup: use term 'edit' instead of 'fix'.
2020-08-20 22:41:56 +10:00
da126dc032
Initial code-clean utility
...
Perform automated edits to source files which are validated to produce
identical binary output.
Currently this has only been tested to work with GCC on Linux.
2020-08-20 16:18:11 +10:00