bazelbuild / bazelbuild/bazel

Add --per_file_cxxopt

Open
#29,700 13 comments 0 reactions 0 assignees View on GitHub
P4 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Some flags are only valid for C++, and the compiler will throw a hard error if we use them for compiling C code. Thus, we can't add them to `--per_file_copt`. It would be good if there was an equivalent command line flag `--per_file_cxxopt`, just like `--cxxopt`.

Same goes for `--host_per_file_cxxopt`

### Which category does this issue belong to?

Core, Configurability

### What underlying problem are you trying to solve with this feature?

Suppress warnings in external code.

### Which operating system are you running Bazel on?

Ubuntu 24.04

### What is the output of `bazel info release`?

8.6.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing --per_file_copt and --cxxopt flag definitions and their host equivalents. Check the associated option parsing and tests, if present, to identify how per-file and host options are represented. Done means both requested C++-specific flags are accepted and applied consistently for target and host compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.