Skip to content

Add header ignore option to readability-duplicate-include #166938

@nick-potenski

Description

@nick-potenski

Our codebase has a few cases where duplicate includes are expected. For example, we have a pair of headers to manage enabling and disabling structure packing which are typically included around a structure that we want packed on a byte boundary.

#include "pack_begin.h"
typedef struct {
} a_packed_struct;
#include "pack_end.h"

typedef struct {
} an_unpacked_struct;

#include "pack_begin.h"  //  readability-duplicate-include warns here
typedef struct {
} another_packed_struct;
#include "pack_end.h" //  readability-duplicate-include warns here

It would be nice if this checker provided a configuration option taking a list of strings or regexes defining headers that are OK to duplicate.

Metadata

Metadata

Assignees

Labels

clang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing featuregood first issuehttps://github.com/llvm/llvm-project/contribute

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions