New issue
Advanced search Search tips

Issue 814297 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Task



Sign in to add a comment

PRESUBMIT for accidentally #including .cc file

Project Member Reported by pmarko@chromium.org, Feb 21 2018

Issue description

In many cases, accidental #includes of .cc files go unnoticed, but are an ODR violation. In some cases, they actually cause problems.
See  bug 713138  for a few that have been fixed.

We might want a PRESUBMIT that guards against #including .cc files accidentally. For sanity, the PRESUBMIT should only run on non-third_party packages.

I suspect that most of the .cc includes found by
https://cs.chromium.org/search/?q=-file:third_party+file:.*%5C.cc+%5C%23include%5C+.*%5C.cc%5C%22&sq=package:chromium&type=cs
are intentional, while some look like mistakes.

Maybe we could have a PRESUBMIT rule saying:
- you may only #include .cc files if the filename contains "-inc"
- there's an additional whitelist of files that may #include .cc files (e.g. base/allocator/debugallocation_shim.cc[1] would be one of them)

[1] https://cs.chromium.org/chromium/src/base/allocator/debugallocation_shim.cc
 

Sign in to add a comment