Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Issue 1631873003: Check system-include dependencies in GN (Closed)

Created:
4 years, 10 months ago by NGG
Modified:
4 years, 10 months ago
Reviewers:
Dirk Pranke, brettw
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Check system-include dependencies in GN "gn check" previously only checked header include lines that used quotes. With this commit all include lines are checked and it still reports OK for the whole chromium repo. This makes GN easier to integrate with external projects and makes the dependency check more robust. R=brettw@chromium.org, dpranke@chromium.org BUG=

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -2 lines) Patch
M AUTHORS View 1 chunk +1 line, -0 lines 0 comments Download
M tools/gn/c_include_iterator.cc View 1 chunk +1 line, -2 lines 0 comments Download
M tools/gn/c_include_iterator_unittest.cc View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
NGG
4 years, 10 months ago (2016-01-26 12:32:05 UTC) #1
Dirk Pranke
why doesn't including <stdio.h> or, perhaps better, something like <sys/errno.h> cause gn check to fail?
4 years, 10 months ago (2016-01-26 22:21:02 UTC) #2
NGG
On 2016/01/26 22:21:02, Dirk Pranke wrote: > why doesn't including <stdio.h> or, perhaps better, something ...
4 years, 10 months ago (2016-01-27 00:00:31 UTC) #3
Dirk Pranke
Okay, the change lgtm , then if it is the intended behavior. Brett, can you ...
4 years, 10 months ago (2016-01-27 00:37:11 UTC) #4
NGG
On 2016/01/27 00:00:31, NGG wrote: > I think this logic should be improved a bit, ...
4 years, 10 months ago (2016-01-27 01:30:56 UTC) #5
brettw
4 years, 10 months ago (2016-02-01 23:53:50 UTC) #6
What ideally would happen is that GN would take into account its understanding
of the include path to be able to resolve all includes. That way we would be
able to handle Chrome-style absolute paths, and other styles used by other
projects, including some third-party projects in Chrome where we have to hack
things a bit.

As-is though, this change will see <stdio.h> and convert it to the GN path
"//stdio.h" and see if it matches any file in the project. If GN doesn't match
any file in the project, it ignores the include. This is pretty confusing
because //stdio.h is definitely not what you meant when you included stdio, and
checking these doesn't add any benefit.

The only thing that this helps are projects that include things by full path
relative to the source, but use <> instead of "" for such includes. This
actually seems pretty rare to me. We have a few instances of screwups in Chrome
where people used <> instead of "", but these were rare and I suspect some of
them were actually to disable the header checker.

Today GN checks headers according to Chrome's include style. This works well but
is incomplete. If we're not happy with this, I think we should do the right
solution I described above rather than trying to hack the current solution.

Powered by Google App Engine
This is Rietveld 408576698