diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..9897515 --- /dev/null +++ b/.clang-format @@ -0,0 +1,15 @@ +# .clang-format — nulsl-libc style. +# +# Rule of thumb: 4-space indent, 100 columns, allman braces off, keep it +# boring. Run `clang-format -i` on your diff before opening a PR. + +BasedOnStyle: LLVM +IndentWidth: 4 +ColumnLimit: 100 +PointerAlignment: Left +DerivePointerAlignment: false +SortIncludes: true +BreakBeforeBraces: Attach +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..96fb59c --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,19 @@ +# .clang-tidy — nulsl-libc lint configuration. +# +# The linter's job is to yell about bugs, not style (style belongs to +# clang-format). Keep the check list tight and useful. + +# A libc owns the reserved namespace by definition (_exit, environ, ...); +# bugprone-reserved-identifier only makes sense for application code. +Checks: > + clang-analyzer-*, + bugprone-*, + performance-*, + portability-*, + -bugprone-easily-swappable-parameters, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-reserved-identifier + +WarningsAsErrors: '' +HeaderFilterRegex: 'include/.*' +FormatStyle: file diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..797d027 --- /dev/null +++ b/.clangd @@ -0,0 +1,19 @@ +# .clangd — LSP configuration for nulsl-libc. +# +# Fallback flags used when compile_commands.json is absent. After running +# `make compile_commands` (requires bear), clangd uses the exact build +# flags from bin/release/ instead, and these are merged on top. +CompileFlags: + Compiler: clang + Add: + - -std=c17 + - -Iinclude + - -ffreestanding + - -fno-builtin + - -Wall + - -Wextra + +# Treat all headers as project headers so warnings apply inside them. +Diagnostics: + Suppress: + - unknown-pragmas diff --git a/.gitignore b/.gitignore index cd531cf..36f404a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,49 +1,50 @@ -# ---> C -# Prerequisites -*.d +# Generated by autotools +aclocal.m4 +autom4te.cache/ +build-aux/ +config.guess +config.h.in +config.log +config.status +config.sub +configure +configure.lineno +depcomp +install-sh +ltmain.sh +missing +Makefile.in -# Object files +# Build artifacts *.o +*.a +*.lo +*.la +.deps/ +.libs/ + +# Generic C artifacts (for experiments outside the autotools flow) *.ko *.obj *.elf - -# Linker output *.ilk *.map *.exp - -# Precompiled Headers *.gch *.pch - -# Libraries *.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) *.dll *.so *.so.* *.dylib - -# Executables *.exe *.out *.app -*.i*86 -*.x86_64 *.hex - -# Debug files *.dSYM/ *.su *.idb *.pdb - -# Kernel Module Compile Results *.mod* *.cmd .tmp_versions/ @@ -52,3 +53,16 @@ Module.symvers Mkfile.old dkms.conf +# Out-of-tree build dirs (the driver Makefile owns these) +bin/release/* +!bin/release/.gitkeep +bin/debug/* +!bin/debug/.gitkeep + +# LSP (generated by `make compile_commands`) +compile_commands.json + +# Editor/agent caches +.cache/ +.omo/ +*~