static inline C functions (mingw's printf and time), macOS libraries that call their host, lld's missing-library message

- a static inline function in a header is called through a pointer a small C file keeps
  (void *finch_inl_f = &f), built with the program's include folders and cached
- --shared on macOS links with -undefined dynamic_lookup, as a .so does on Linux
- "unable to find library -lx" (lld, MinGW) gives the library-not-found advice
- the language server test shows the index records when alias completion fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
This commit is contained in:
Nexoniarz 2026-10-29 11:53:24 +01:00
commit ff72f68804
8 changed files with 81 additions and 13 deletions

View file

@ -18,6 +18,7 @@ struct CFunc {
ast.Type ret
[]ast.Type params
bool variadic
bool inline // static inline in the header: called through a pointer a small C file keeps (finch_inl_name)
str unsupported // non-empty: why Finch can't call it (yet)
}
@ -535,9 +536,7 @@ fn visit(ptr[Importer] imp, CXCursor c) {
}
f := CFunc(name: name, header: imp.header)
if clang_Cursor_getStorageClass(c) == CX_SC_Static {
f.unsupported = "is a static inline C function (it has no code to link against)"
imp.out.fns[name] = f
return
f.inline = true // mingw's printf and time, header-only helpers
}
ft := clang_getCanonicalType(clang_getCursorType(c))
if ft.kind == CXType_FunctionNoProto {