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

Issue 1038233002: tools/gn: disallow non-canonical integer literals (Closed)

Created:
5 years, 9 months ago by mdempsky
Modified:
5 years, 8 months ago
Reviewers:
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

tools/gn: disallow non-canonical integer literals In most languages familiar to Chromium developers (e.g., C++, JavaScript, Python, Java, Go, Bash, Perl, Ruby), a leading 0 in an integer literal indicates an octal number. For example, "010" and "-010" represent 8 and -8, respectively. GN doesn't have any use for octal integer literals, so reject integers with leading zeros to avoid confusion rather than interpreting them as decimal values. While here, "-0" isn't useful either since it's equivalent to "0", so reject that too. No Chromium BUILD.gn files are affected by this change. Committed: https://crrev.com/b45ed217c61cd69eee2eafd9dbf5798520685538 Cr-Commit-Position: refs/heads/master@{#323142}

Patch Set 1 #

Patch Set 2 : Add note to "gn help grammar" #

Total comments: 3

Patch Set 3 : Just "auto"; it's cleaner #

Total comments: 2

Patch Set 4 : Replace "auto" with "base::StringPiece" #

Total comments: 3

Patch Set 5 : Move kBad tests down by usage #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -1 line) Patch
M tools/gn/parse_tree.cc View 1 2 3 1 chunk +9 lines, -1 line 0 comments Download
M tools/gn/parse_tree_unittest.cc View 1 2 3 4 1 chunk +36 lines, -0 lines 0 comments Download
M tools/gn/parser.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (3 generated)
mdempsky
5 years, 9 months ago (2015-03-26 23:52:37 UTC) #2
tfarina
https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc#newcode637 tools/gn/parse_tree.cc:637: const auto& s = value_.value(); could you not use ...
5 years, 9 months ago (2015-03-27 00:02:54 UTC) #3
mdempsky
https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc#newcode637 tools/gn/parse_tree.cc:637: const auto& s = value_.value(); On 2015/03/27 00:02:54, tfarina ...
5 years, 9 months ago (2015-03-27 00:12:17 UTC) #4
mdempsky
https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/20001/tools/gn/parse_tree.cc#newcode637 tools/gn/parse_tree.cc:637: const auto& s = value_.value(); On 2015/03/27 00:12:17, mdempsky ...
5 years, 9 months ago (2015-03-27 00:14:18 UTC) #5
tfarina
https://codereview.chromium.org/1038233002/diff/30001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/30001/tools/gn/parse_tree.cc#newcode637 tools/gn/parse_tree.cc:637: auto s = value_.value(); to not use it at ...
5 years, 9 months ago (2015-03-27 00:17:17 UTC) #6
mdempsky
https://codereview.chromium.org/1038233002/diff/30001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/30001/tools/gn/parse_tree.cc#newcode637 tools/gn/parse_tree.cc:637: auto s = value_.value(); On 2015/03/27 00:17:17, tfarina wrote: ...
5 years, 9 months ago (2015-03-27 00:18:54 UTC) #7
tfarina
Thanks for the auto change. https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree.cc File tools/gn/parse_tree.cc (right): https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree.cc#newcode638 tools/gn/parse_tree.cc:638: if ((s.starts_with("0") && s.size() ...
5 years, 9 months ago (2015-03-27 00:25:27 UTC) #8
mdempsky
Ping?
5 years, 8 months ago (2015-03-30 20:09:44 UTC) #9
brettw
lgtm https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree_unittest.cc File tools/gn/parse_tree_unittest.cc (right): https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree_unittest.cc#newcode225 tools/gn/parse_tree_unittest.cc:225: const char *bad[] = { I think it ...
5 years, 8 months ago (2015-03-31 23:05:34 UTC) #10
mdempsky
https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree_unittest.cc File tools/gn/parse_tree_unittest.cc (right): https://codereview.chromium.org/1038233002/diff/50001/tools/gn/parse_tree_unittest.cc#newcode225 tools/gn/parse_tree_unittest.cc:225: const char *bad[] = { On 2015/03/31 23:05:33, brettw ...
5 years, 8 months ago (2015-03-31 23:19:20 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1038233002/70001
5 years, 8 months ago (2015-03-31 23:19:43 UTC) #14
commit-bot: I haz the power
Committed patchset #5 (id:70001)
5 years, 8 months ago (2015-03-31 23:58:32 UTC) #15
commit-bot: I haz the power
5 years, 8 months ago (2015-03-31 23:59:07 UTC) #16
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/b45ed217c61cd69eee2eafd9dbf5798520685538
Cr-Commit-Position: refs/heads/master@{#323142}

Powered by Google App Engine
This is Rietveld 408576698