Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ccls does not recognize C attributes #965

Open
computerscience-person opened this issue Jun 8, 2024 · 1 comment
Open

ccls does not recognize C attributes #965

computerscience-person opened this issue Jun 8, 2024 · 1 comment

Comments

@computerscience-person
Copy link

computerscience-person commented Jun 8, 2024

Observed behavior

ccls gives an error on C attributes (feature was standardized in C23 and is supported by clang 9 and gcc 10).

Minimal example:

[[nodiscard]] void* identity(void* item) {
  return item;
}

Expected behavior

No error (feature standardized in C23).

Steps to reproduce

Minimal example:

[[nodiscard]] void* identity(void* item) {
  return item;
}

System information

  • ccls version (git describe --tags --long): 0.20240202
  • clang version: 14.0.6
  • OS: Linux nixos 6.6.32
  • Editor: Neovim
  • Language client (and version):
@rherilier
Copy link

Did you use -std=c2x or -std=c23 as compilation flag?

As your ccls seems to be build against clang 14.0.6 (which has been released in 2022 while C23 is only official since February), I suppose you are compiling with the later when you should use the former to make ccls use the correct C version.

As my box runs Debian testing (which rely on llvm 19.x), I did some tests using a c27 project with ccls and clangd:

  • ccls does not complain at all (surely because it fell back to c23);
  • clangd-16 complains about the wrong compilation flag and the C attribute (surely because it fell back to c17);
  • clangd-19 complains about the wrong compilation flag but not about the C attribute (surely because it fell back to c23).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants