mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-04 02:46:06 -04:00
Clang-Format 14 (#1321)
* format * Update dockerfile and other documentation * Update mac instructions
This commit is contained in:
@@ -11,17 +11,20 @@ For macOS, use Homebrew to install the following dependencies:
|
||||
* python3
|
||||
* libpng
|
||||
* bash
|
||||
* clang-format 11
|
||||
|
||||
You can install them with the following commands:
|
||||
|
||||
```bash
|
||||
brew update
|
||||
brew install coreutils make python3 libpng bash clang-format@11
|
||||
brew install coreutils make python3 libpng bash
|
||||
```
|
||||
|
||||
(The repository expects Homebrew-installed programs to be either linked correctly in `$PATH` etc. or in their default locations.)
|
||||
|
||||
Homebrew does not have clang-format-14 but MacPorts does
|
||||
|
||||
(Have been unable to confirm actual commands with somone that has a Mac)
|
||||
|
||||
## Building mips-linux-binutils
|
||||
|
||||
The following instructions are written for MacOS users but should apply to any Unix-like system, with maybe some modifications at the end regarding the bash_profile.
|
||||
|
||||
@@ -110,7 +110,7 @@ See the [Style Guide](STYLE.md) for more details on documentation style.
|
||||
Before opening a PR, walk through the following steps to ensure that your code conforms to the style guide and conventions.
|
||||
|
||||
- `make` successfully builds a matching ROM.
|
||||
- `./format.sh` was run to apply standard formatting.
|
||||
- `./format.py` was run to apply standard formatting.
|
||||
- No new compiler warnings were introduced during the build process.
|
||||
- Can be verified locally by running `tools/warnings_count/check_new_warnings.sh`
|
||||
- New variables & functions should follow standard naming conventions.
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ You should first famiiarise yourself with our [Contributing guide](CONTRIBUTING.
|
||||
|
||||
- [ ] Jenkins build is successful.
|
||||
- [ ] `make` builds a matching ROM.
|
||||
- [ ] `format.sh` was run.
|
||||
- [ ] `format.py` was run.
|
||||
- [ ] `spec` contains correct relocation files.
|
||||
- [ ] Any new compiler warnings that were added are required for matching. Ensure there is good reason if the warnings files have changed.
|
||||
- [ ] Files with `NON_MATCHING` functions have equivalent behaviour.
|
||||
|
||||
+8
-10
@@ -198,29 +198,27 @@ Fixes line endings in the repo to Linux style (LF), which is required for the bu
|
||||
|
||||
### `format.py`
|
||||
|
||||
Formats all C files in the repo using `clang-format-11`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer.
|
||||
Formats all C files in the repo using `clang-format-14`, `clang-tidy`, and `clang-apply-replacements` (when multiprocessing). This will touch all files in the repo, so the next `make` will take longer.
|
||||
|
||||
You can specify how many threads you would like this to run with by adding the `-jN` flag. Where N is the number of threads. By default this will run using 1 thread (i.e. `-j1`).
|
||||
|
||||
`clang-11` is available in many native package managers, but if not try:
|
||||
`clang-14` is available in many native package managers, but if not try:
|
||||
|
||||
Linux:
|
||||
Download llvm's setup script, run it, than install normally
|
||||
```bash
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 11
|
||||
sudo ./llvm.sh 14
|
||||
rm llvm.sh
|
||||
sudo apt install clang-format-11 clang-tidy-11 clang-apply-replacements-11
|
||||
sudo apt install clang-format-14 clang-tidy-14 clang-apply-replacements-14
|
||||
```
|
||||
|
||||
Mac:
|
||||
Install with brew, than create symlinks for `clang-tidy` and `clang-apply-replacements` to use properly
|
||||
```bash
|
||||
brew install llvm clang-format-11
|
||||
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy"
|
||||
ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements"
|
||||
```
|
||||
Brew does not have clang-format-14, but MacPorts does.
|
||||
|
||||
(Have been unable to confirm actual commands with somone that has a Mac)
|
||||
|
||||
|
||||
## External tools
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Ideally you should at least be able to get a function to have equivalent behavio
|
||||
|
||||
### Format
|
||||
|
||||
Run the formatting script `format.sh`, to format the C files in the standard way we use. If you have some arrays or struct definitions in your file, check that they have not been obnoxiously padded out: you can usually get a better format without a final comma for short things.
|
||||
Run the formatting script `format.py`, to format the C files in the standard way we use. If you have some arrays or struct definitions in your file, check that they have not been obnoxiously padded out: you can usually get a better format without a final comma for short things.
|
||||
|
||||
**N.B.** this is now essential: the CI will fail immediately if it detects files that change when formatted.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user