Skip to content

hdrs includes are passed as -isystem to clang, suppressing important warnings #523

@froody

Description

@froody

By default, most include paths passed to clang when using toolchains_llvm are passed as -isystem, which suppresses many warnings. This wasted a lot of time for me the other day when I accidentally declared a function with a bool return type and no return value. This is easily caught by clang under normal circumstances as I pass -Wall and -Werror, but due to the way headers are included, the warning/error never surfaced and it took hours to find.

For this target:

cc_libray(
name = "foo",
srcs=glob(["foo/*.cpp"]),
hdrs=glob(["foo/*.hpp"]),
)

I would expect things like -Wreturn-type violations in .hpp files to fail the build, but the way clang is currently invoked they don't.

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