How to disable [chromium-style] warning on a target?

791 views
Skip to first unread message

Xiaohan Wang (王消寒)

unread,
Dec 29, 2020, 1:52:17 PM12/29/20
to chromium-dev
Is there a way to disable [chromium-style] warning for a particular target? e.g.

warning: [chromium-style] Overriding method must be marked with 'override' or 'final'.

This could be useful because there are some third party code that's not written by us that we can't really control the style of.

I also found https://dev.chromium.org/developers/coding-style/chromium-style-checker-errors, but I don't see an easy way to turn it off...

Thanks and happy new year!

Best,
Xiaohan

Peter Kasting

unread,
Dec 29, 2020, 2:06:43 PM12/29/20
to xhw...@chromium.org, chromium-dev
On Tue, Dec 29, 2020 at 10:51 AM Xiaohan Wang (王消寒) <xhw...@chromium.org> wrote:
Is there a way to disable [chromium-style] warning for a particular target? e.g.

warning: [chromium-style] Overriding method must be marked with 'override' or 'final'.

This could be useful because there are some third party code that's not written by us that we can't really control the style of.

Code that's third-party is not supposed to trip this checker.  Sounds like some kind of GN config for third party code is not being set correctly on this code?

PK

Xiaohan Wang (王消寒)

unread,
Dec 29, 2020, 2:10:12 PM12/29/20
to Peter Kasting, chromium-dev
That makes sense. Where's the special logic to prevent third party code from triggering this checker?

PK

Peter Kasting

unread,
Dec 29, 2020, 2:23:01 PM12/29/20
to Xiaohan Wang (王消寒), chromium-dev
I think it has something to do with the chromium_code and no_chromium_code configs, but I'm not sure you're supposed to Just Set Those.  There may be some other "third party code" flag?

PK

Daniel Cheng

unread,
Dec 29, 2020, 2:41:26 PM12/29/20
to Peter Kasting, Xiaohan Wang (王消寒), chromium-dev
The Chrome style plugin itself has some heuristics to try to detect third-party code.

If that fails, using the no_chromium_code config option is probably the right thing to do—though it'd be nice to understand why the third-party heuristics aren't triggered.

Danirl

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAAHOzFC0dOjS%2B772Abx97j2X37UgZotv_KfVjgpex%2Bab%2BnRG8A%40mail.gmail.com.

dan...@chromium.org

unread,
Dec 29, 2020, 4:02:51 PM12/29/20
to Daniel Cheng, Peter Kasting, Xiaohan Wang (王消寒), chromium-dev

Noel Gordon

unread,
Dec 29, 2020, 8:17:26 PM12/29/20
to Chromium-dev, danakj, Peter Kasting, Xiaohan Wang, chromium-dev, Daniel Cheng
And if those heuristics are not working, add controls to your third_party code BUILD.gn, for example ...

https://source.chromium.org/chromium/chromium/src/+/master:third_party/zlib/BUILD.gn;l=396-397;drc=49bce2f7a08bea183f39892a075be9ff92dc3c39

~noel


Xiaohan Wang (王消寒)

unread,
Jan 8, 2021, 1:23:58 PM1/8/21
to Noel Gordon, Chromium-dev, danakj, Peter Kasting, Daniel Cheng
To close the loop, `no_chromium_code` config controls a lot of settings but it has no effect on [chromium-style] warnings. These warnings are generated by the FindBadConstructs plugin which is enabled by "//build/config/clang:find_bad_constructs". Chasing down LocationType::kThirdParty should be the right direction but it's a bit hard to apply in my case. So I just ended up disabling `clang_use_chrome_plugins` in gn args.
Reply all
Reply to author
Forward
0 new messages