# clangd settings for zash.  `make compdb` writes compile_commands.json; this
# file adds what that database cannot say.
CompileFlags:
  # The build uses these (see CSTD and CPPFLAGS in the Makefile), so the
  # editor sees the same language level and feature macros.
  Add: [-std=c17, -D_XOPEN_SOURCE=700, -Wall, -Wextra, -Wshadow,
        -Wstrict-prototypes, -Wmissing-prototypes, -Wconversion,
        -Wno-sign-conversion]
  # IBM Open XL and the z/OS-only file are not built on Linux.
  Remove: [-fzos-le-char-mode=*, -m64]
  CompilationDatabase: .

---
# The z/OS layer includes <spawn.h> constants that Linux headers lack, so
# do not flag them while editing on Linux.
If:
  PathMatch: src/sys_zos\.c
Diagnostics:
  Suppress: ['*']

---
# Tests and benchmarks are shell scripts, not C.
If:
  PathMatch: (tests|bench)/.*
Diagnostics:
  Suppress: ['*']

---
Diagnostics:
  UnusedIncludes: Strict
  MissingIncludes: Strict
  ClangTidy:
    # Use .clang-tidy; do not duplicate its checks here.
    FastCheckFilter: Strict
    # Two checks .clang-tidy already switches off or allows.  clangd applies
    # its CheckOptions unevenly between clang-tidy versions, so name them
    # here too.  The tree writes `if (ptr)` and spells C11 keywords such as
    # _Static_assert, which are the implementation's namespace to define.
    Remove:
      - readability-implicit-bool-conversion
      - bugprone-reserved-identifier
Index:
  Background: Build
InlayHints:
  Enabled: false
Hover:
  ShowAKA: true
Completion:
  AllScopes: false
Style:
  FullyQualifiedNamespaces: []
