Skip to content

<errno.h> marked as unused when using errno in variadic macro #2588

Open

Description

@tjarross

<errno.h> is marked as unused ( clangd(unused-includes) ) when errno is sent as a parameter of a variadic macro.
errno macro is also not coloured in blue as it should be.

#include <errno.h>
#include <stdio.h>

#define LOG_ERROR(fmt, args...) fprintf(stderr, fmt, ##args)

int main(void)
{
    LOG_ERROR("%d\n", errno);
}
Image

System information

Output of clangd --version: 21.1.8

Editor/LSP plugin: VS Codium (v1.96.4) with Clangd Extension (v0.4.0)

Operating system: Linux Debian 13

Activity

  1. changed the title [-]header marked as unused when sending errno in variadic macro[/-] [+]errno.h marked as unused when sending errno in variadic macro[/+] on Jan 20, 2026
  2. changed the title [-]errno.h marked as unused when sending errno in variadic macro[/-] [+]errno.h marked as unused when using errno in variadic macro[/+] on Jan 20, 2026
  3. changed the title [-]errno.h marked as unused when using errno in variadic macro[/-] [+]<errno.h> marked as unused when using errno in variadic macro[/+] on Jan 20, 2026
  4. HighCommander4 commented on Feb 5, 2026

    @HighCommander4
    Contributor

    What are the ## characters doing in your macro definition?

    Both of the symptoms you describe disappear if you remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions