editor: clangd and cmake work from a committed vscode workspace
The three files libavr's consumers carry: .vscode/settings.json names the atmega328p-generated database and passes --query-driver, .clangd holds the stand-ins clang needs for GCC's AVR dialect -- and no database, because this driver is made to be vendored and the file travels with it -- and extensions.json names the two extensions. The libavr pin advances to the editor-audit fixes, without which every TU inherits device.hpp's alias-shadowing errors. The preset builds green from the pin and clangd reports zero errors on the example TU. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
32
.clangd
Normal file
32
.clangd
Normal file
@@ -0,0 +1,32 @@
|
||||
# Editor accommodations for the second frontend. No compilation database is
|
||||
# named here: this driver is made to be vendored, and this file travels with
|
||||
# it — a consumer's own database then covers these headers, at the consumer's
|
||||
# chip. The checkout that is opened as a folder names its build tree in
|
||||
# .vscode/settings.json instead.
|
||||
CompileFlags:
|
||||
Add:
|
||||
# clang has no 24-bit integer and GCC's are keywords, not macros, so the
|
||||
# editor needs a stand-in for avr::uint24_t. The next width up is the only
|
||||
# one available — clang rejects _BitInt(24) on this target.
|
||||
- -D__uint24=unsigned long
|
||||
- -D__int24=long
|
||||
# clangd forwards the driver's system includes but not its own header
|
||||
# directory, so <stdint.h> resolves to avr-libc's, which still gates the
|
||||
# limit and constant macros on the C++98 opt-in.
|
||||
- -D__STDC_LIMIT_MACROS
|
||||
- -D__STDC_CONSTANT_MACROS
|
||||
# isr::emit spells a vector number into [[gnu::signal(N)]], which clang
|
||||
# rejects rather than ignores — enough of them in one TU to reach the
|
||||
# default limit of 19 inside the headers and truncate the parse.
|
||||
- -ferror-limit=0
|
||||
Remove:
|
||||
# The build promotes warnings for the compiler that has to be right about
|
||||
# them; in the editor the flag paints a second frontend's opinions in the
|
||||
# colour reserved for things that do not compile.
|
||||
- -Werror
|
||||
Diagnostics:
|
||||
Suppress:
|
||||
# clang's AVR `signal` attribute takes no arguments and it knows none of
|
||||
# progmem, naked or OS_main. A misspelling is what the build is for.
|
||||
- attribute_wrong_number_arguments
|
||||
- unknown-attributes
|
||||
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
"ms-vscode.cmake-tools"
|
||||
]
|
||||
}
|
||||
37
.vscode/settings.json
vendored
Normal file
37
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
// clangd is the language server; the cpptools engine would parse every file
|
||||
// a second time and disagree, since nothing tells it about a cross
|
||||
// compiler.
|
||||
"C_Cpp.intelliSenseEngine": "disabled",
|
||||
|
||||
// --query-driver lets clangd ask the cross compiler for its own system
|
||||
// includes and target. The database is named here rather than in .clangd
|
||||
// because that file travels with the driver into a consumer's submodule,
|
||||
// where a build tree of this repo's own need not exist.
|
||||
"clangd.arguments": [
|
||||
"--compile-commands-dir=${workspaceFolder}/build/atmega328p-generated",
|
||||
"--query-driver=**avr-g++*",
|
||||
"--header-insertion=never"
|
||||
],
|
||||
|
||||
// The presets are the build interface; the toolchain file inside the
|
||||
// libavr submodule is the one place the compiler is chosen. The submodule
|
||||
// carries no local/toolchain for it to discover, so the prefix is named
|
||||
// here, for the window that opens this folder.
|
||||
"cmake.useCMakePresets": "always",
|
||||
"cmake.environment": {
|
||||
"LIBAVR_TOOLCHAIN": "D:/dev/libavr/local/toolchain/avr-gcc-16.1.0-mingw"
|
||||
},
|
||||
"cmake.configureOnOpen": true,
|
||||
"cmake.options.statusBarVisibility": "compact",
|
||||
|
||||
"files.watcherExclude": {
|
||||
"**/build/**": true,
|
||||
"**/libavr/**": true
|
||||
},
|
||||
|
||||
"files.associations": {
|
||||
".clangd": "yaml",
|
||||
".clang-format": "yaml"
|
||||
}
|
||||
}
|
||||
2
libavr
2
libavr
Submodule libavr updated: 26109e172b...07a0c40235
Reference in New Issue
Block a user