ccls icon indicating copy to clipboard operation
ccls copied to clipboard

Header file warnings appear in source file

Open tesselslate opened this issue 2 years ago • 0 comments

Edit: Initially, I only observed this with "declaration without prototype" cases. It seems to appear with other warnings, such as "internal linkage but not defined."

Observed behavior

When a function is declared in a header file and an identically named function prototype is in a source file, ccls produces a warning in the source file instead of the header file. The warning appears at the same spot as it would if it were in the header file.

This only occurs when the header file contains a definition and not a prototype.

image

Expected behavior

The warning should either appear in the header file where the function is initially declared (as it does when running clang), or at the prototype in the source file.

Steps to reproduce

test.c:

#include "test.h"

void a(int x) {}

test.h:

void a();

System information

  • ccls version (git describe --tags --long): 0.20220729-4-g8bc39595
  • clang version: 15.0.7
  • OS: Arch Linux
  • Editor: nvim
  • Language client (and version): nvim-lspconfig 08f1f34

tesselslate avatar Jun 12 '23 00:06 tesselslate