From f50cc749e7375055aa3ad8d1e487db4366bb3bd0 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Fri, 23 Oct 2026 21:55:47 +0200 Subject: [PATCH] chore: the editor reads the selected preset's database, and the config states no history clangd's database is the one CMake Tools copies from the selected preset, as in libavr, rather than one chip's tree. .gitattributes drops two Studio patterns nothing here matches, .clangd is ASCII, and the comments in it, check.sh and .gitattributes state the reason without the account of how it was found. Co-Authored-By: Claude Opus 5.5 --- .clangd | 6 +++--- .gitattributes | 10 +++------- .vscode/settings.json | 17 ++++++++++------- tools/check.sh | 10 +++++----- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.clangd b/.clangd index e07ab19..aec1172 100644 --- a/.clangd +++ b/.clangd @@ -1,13 +1,13 @@ # 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 +# 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. + # 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 @@ -16,7 +16,7 @@ CompileFlags: - -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 + # 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: diff --git a/.gitattributes b/.gitattributes index 6755504..3b9741d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,8 @@ -# Line endings are the repository's, not the editing machine's: this checkout -# is reached from two hosts, and a file rewritten by a Windows tool comes back -# with every line changed unless something says otherwise. Naming the source -# extensions left Markdown, Python, shell and CMake to whatever the writing -# tool defaulted to, which is CRLF on one of the two. +# Line endings are the repository's, not the editing tool's (libavr guidance +# rule 50): a file rewritten by a Windows tool must not come back with every +# line changed. * text=auto eol=lf # Atmel Studio writes these and expects them back. -*.vcxproj* eol=crlf *.cppproj eol=crlf -*.sln eol=crlf *.atsln eol=crlf diff --git a/.vscode/settings.json b/.vscode/settings.json index d598a4e..3eb5f75 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,25 +7,28 @@ // --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. + // where a build tree of this repo's own need not exist. It sits one level + // above the trees, and CMake Tools copies the selected preset's into it on + // every configure: the database carries `-mmcu`, so a fixed tree would + // check the driver against one chip. "clangd.arguments": [ - "--compile-commands-dir=${workspaceFolder}/build/atmega328p-generated", + "--compile-commands-dir=${workspaceFolder}/build", "--query-driver=**avr-g++*", "--header-insertion=never" ], + "cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json", // The presets are the build interface, and the toolchain file inside the - // libavr submodule is the one place the compiler is chosen. **No prefix is - // named here**: a committed file may not name a path that is true of one - // machine (libavr guidance rule 50), so the gitignored local/machine.cmake - // at this repository's root is where a checkout says where its toolchain - // is - one file, and it answers for both hosts. + // libavr submodule is the one place the compiler is chosen. No prefix is + // named here: the gitignored local/machine.cmake at this repository's root + // is where a checkout says where its toolchain is (libavr guidance rule 50). "cmake.useCMakePresets": "always", "cmake.configureOnOpen": true, "cmake.options.statusBarVisibility": "compact", "files.watcherExclude": { "**/build/**": true, + "**/local/**": true, "**/libavr/**": true }, diff --git a/tools/check.sh b/tools/check.sh index 40de33e..314b042 100755 --- a/tools/check.sh +++ b/tools/check.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash # The task gate: every configure preset built, and only then every one tested. # -# The loop itself is libavr's (tools/check-presets.sh) because the order in it -# is subtle and was got wrong by hand more than once - the mode-identity checks -# read the sibling mode's tree, so a build-then-test-per-preset run compares a -# fresh image against a stale sibling. Anything this repository needs beyond -# the presets is written after the call, where every tree is built and tested. +# The loop itself is libavr's (tools/check-presets.sh): the mode-identity +# checks read the sibling mode's tree, so a build-then-test-per-preset run +# would compare a fresh image against a stale sibling. Anything this repository +# needs beyond the presets is written after the call, where every tree is built +# and tested. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." "${LIBAVR_ROOT:-libavr}/tools/check-presets.sh" "$@"