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

Add external_include_paths C++ feature #13107

Closed
wants to merge 1 commit into from

Conversation

erenon
Copy link
Contributor

@erenon erenon commented Feb 25, 2021

Projects with strict warnings level experience issues when they depend on third party libraries with less-strict warnings: The compiler will emit warnings for external sources. See #12009 for more.

This change optionally silences those warnings, by changing -I flags to -isystem flags and by adding -isystem flags for each -iquote flag, in case of external dependencies, i.e: those targets that come from a non-main workspace.

The new behavior can be enabled by --features=external_include_paths, otherwise there's no functional change.

The default flag_group in unix_cc_toolchain_config will silence warnings coming from -I and -iquote dirs in case of GCC, and -I for Clang. Clang will still produce warnings for -iquote dirs, therefore the Clang specific --system-header-prefix is recommended instead.

@google-cla google-cla bot added the cla: yes label Feb 25, 2021
@lberki lberki removed their request for review February 25, 2021 14:20
Projects with strict warnings level experience issues when they
depend on third party libraries with less-strict warnings:
The compiler will emit warnings for external sources.
See bazelbuild#12009 for more.

This change optionally silences those warnings, by changing -I flags to
-isystem flags and by adding -isystem flags for each -iquote flag, in
case of external dependencies, i.e: those targets that come from a
non-main workspace.

The new behavior can be enabled by --features=external_include_paths,
otherwise there's no functional change.

The default flag_group in unix_cc_toolchain_config will silence warnings
coming from -I and -iquote dirs in case of GCC, and -I for Clang. Clang
will still produce warnings for -iquote dirs, therefore the Clang
specific --system-header-prefix is recommended instead.
@jin jin added the team-Rules-CPP Issues for C++ rules label Mar 1, 2021
Copy link
Contributor

@oquenchil oquenchil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

LGTM

@erenon
Copy link
Contributor Author

erenon commented Mar 29, 2021

Gentel reminder.

@aiuto
Copy link
Contributor

aiuto commented Mar 31, 2021

@oquenchil Are you going to approve and merge?

@bazel-io bazel-io closed this in 08936ae Apr 1, 2021
tpudlik added a commit to tpudlik/rules_cc_toolchain that referenced this pull request Feb 3, 2023
This useful feature was added to the default Bazel C++ toolchain
in Bazel 5.0; see bazelbuild/bazel#13107.

Fixes bazelembedded#46
tpudlik added a commit to tpudlik/rules_cc_toolchain that referenced this pull request Feb 3, 2023
This useful feature was added to the default Bazel C++ toolchain
in Bazel 5.0; see bazelbuild/bazel#13107.

Fixes bazelembedded#46
tpudlik added a commit to tpudlik/rules_cc_toolchain that referenced this pull request Feb 3, 2023
This useful feature was added to the default Bazel C++ toolchain
in Bazel 5.0; see bazelbuild/bazel#13107.

Fixes bazelembedded#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants