Skip to content

[clang-format] Ignore preprocessor directives during header groups analysis #142229

Open
@EugeneZelenko

Description

@EugeneZelenko

Sometimes compiler warnings must be disabled in third-party code, but related preprocessor directives are considered by Clang-Format as header group boundary what makes Clang-Format unable to find main header (included after third-party headers).

Code snippet:

#include <Python.h>
#ifdef __GNUC__
#   pragma GCC diagnostic push
#   pragma GCC diagnostic ignored "-Wpedantic"
#   pragma GCC diagnostic ignored "-Wshadow"
#   pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#define BOOST_NO_AUTO_PTR
#include <boost/python/import.hpp>
#include <boost/python/object.hpp>
#ifdef __GNUC__
#   pragma GCC diagnostic pop
#endif
# include "application_header1.h"
...
# include "application_headerN.h"

I tried 19.1.1 and main (49d48c3)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions