Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Header file warnings appear in source file #941

Open
tesselslate opened this issue Jun 12, 2023 · 0 comments
Open

Header file warnings appear in source file #941

tesselslate opened this issue Jun 12, 2023 · 0 comments

Comments

@tesselslate
Copy link

tesselslate commented Jun 12, 2023

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 tesselslate changed the title Misplaced "declaration without prototype" warnings Header file warnings appear in source file Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant