Closed Bug 1650335 Opened 2 years ago Closed 3 months ago

[Automated review] clang-tidy fails on C files

Categories

(Developer Infrastructure :: Source Code Analysis, defect, P3)

Tracking

(firefox99-, firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox99 - ---
firefox104 --- fixed

People

(Reporter: glandium, Assigned: andi)

Details

Attachments

(1 file)

Phabricator URL: https://phabricator.services.mozilla.com/D82144

[task 2020-07-03T08:41:18.090Z] error: invalid argument '-std=c++17' not allowed with 'C' [clang-diagnostic-error]

Those files shouldn't have the -std=c++17 attribute passed to the command in compile_commands.json, probably they should have -std=gnu99 like the rest of the c files. Probably they must be set in the moz.build directory, something like CFLAGS += ['-std=gnu99']?

The severity field is not set for this bug.
:andi, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bpostelnicu)

This should be closed since the target files no longer exist.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(bpostelnicu)
Resolution: --- → INVALID

We still have C files in the tree. I don't see why things would be different for them.

Status: RESOLVED → REOPENED
Resolution: INVALID → ---

Looking at compile_commands.json the rest of C files look to have the right standard passed to command, -std=gnu99. So this issue nor anything related to this doesn't happen anymore.

Are you sure this is til the case?

Flags: needinfo?(mh+mozilla)
Flags: needinfo?(mh+mozilla)

It seems I have the same issue here:

https://phabricator.services.mozilla.com/D139533#4572683

compile_commands.json seems correct, but it happens when running mach static-analysis check <c file>. The problem comes from python/mozbuild/mozbuild/code_analysis/mach_commands.py line 560 which adds -extra-arg=-std=c++17; by removing that line, the static analysis succeeds.

I don't know how to fix it, one could add an if *.cpp in sources? but in my case (D139533), _get_clang_tidy_command gets called with 2 mixed sources files: one .c and one .cpp.

Flags: needinfo?(bpostelnicu)
Assignee: nobody → bpostelnicu
Severity: -- → S1
Flags: needinfo?(bpostelnicu)
Priority: -- → P1

99 is about to ship, not tracking for this release.

Severity: S1 → S2
Priority: P2 → --
Severity: S2 → S3
Priority: -- → P3
Attachment #9284267 - Attachment description: WIP: Bug 1650335 - for `clang-tidy` based analysis do not set cpp std option. → Bug 1650335 - for `clang-tidy` based analysis do not set cpp std option.
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/418a7fc3fa01
for `clang-tidy` based analysis do not set cpp std option. r=marco
Status: REOPENED → RESOLVED
Closed: 2 years ago3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.