[WIP] Add syntax check for rust and C\C++ code (#108)

* proof of concept

* fix syntax for rust and add auto fix syntax

* fix syntax for C

* fix bug with files owner

* add information to wiki

* try to add ci

* format code from master

* even more format fixes

* change docker to docker-compose

* Exclude ./target_*/build directories from format check

* Run rustfmt only on project files

* add ulimit setup for long clang list

* merge

* fix rustfmt, exclude target Inc directory

* sync with master

* abspath

Co-authored-by: aanper <mail@s3f.ru>
Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
Nikita Beletskii
2020-09-30 02:18:30 +03:00
committed by GitHub
parent 7ded31c19d
commit 110a9efc3c
73 changed files with 4354 additions and 4667 deletions

View File

@@ -54,7 +54,7 @@ impl BindingsGenerator {
"Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
];
let stm32_sdk_includes = stm32_sdk_includes
.iter()
.map(|stm32_include| format!("{}/{}", self.clib_dir.to_string_lossy(), stm32_include));
@@ -64,28 +64,23 @@ impl BindingsGenerator {
let includes = [
// This are bindings generated by cbindgen nearby
&flipper_core_bindings.to_string_lossy(),
&self.gcc_include_dir.to_string_lossy(),
];
#[rustfmt::skip]
return bindgen::Builder::default()
.use_core()
.ctypes_prefix("self")
.blacklist_type("__uint8_t")
.blacklist_type("__uint32_t")
.blacklist_type("c_int")
.blacklist_type("__int32_t")
// TODO there's no .no_debug method, to disable only for specific type
.derive_debug(false)
.clang_arg("-DUSE_HAL_DRIVER")
.clang_arg("-DSTM32L476xx")
.clang_arg("-DBUTON_INVERT=false")
.clang_arg("-DDEBUG_UART=huart1")
.clang_args(
(includes.iter().map(|x| From::from(x as &str)).chain(stm32_sdk_includes))
.map(|include| format!("-I{}", include))
@@ -268,7 +263,7 @@ impl BindingsGenerator {
bindings
.write_to_file(result_path)
.expect("Couldn't write bindings!");
}
}
}
fn detect_gcc_inclide_dir() -> PathBuf {