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

Side by Side Diff: tools/gn/ninja_binary_target_writer.cc

Issue 1879723002: Quote flags in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/ninja_binary_target_writer.h" 5 #include "tools/gn/ninja_binary_target_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <cstring> 10 #include <cstring>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 private: 44 private:
45 bool flags_[static_cast<int>(SOURCE_NUMTYPES)]; 45 bool flags_[static_cast<int>(SOURCE_NUMTYPES)];
46 }; 46 };
47 47
48 namespace { 48 namespace {
49 49
50 // Returns the proper escape options for writing compiler and linker flags. 50 // Returns the proper escape options for writing compiler and linker flags.
51 EscapeOptions GetFlagOptions() { 51 EscapeOptions GetFlagOptions() {
52 EscapeOptions opts; 52 EscapeOptions opts;
53 opts.mode = ESCAPE_NINJA_COMMAND; 53 opts.mode = ESCAPE_NINJA_COMMAND;
54
55 // Some flag strings are actually multiple flags that expect to be just
56 // added to the command line. We assume that quoting is done by the
57 // buildfiles if it wants such things quoted.
58 opts.inhibit_quoting = true;
59
60 return opts; 54 return opts;
61 } 55 }
62 56
63 struct DefineWriter { 57 struct DefineWriter {
64 DefineWriter() { 58 DefineWriter() {
65 options.mode = ESCAPE_NINJA_COMMAND; 59 options.mode = ESCAPE_NINJA_COMMAND;
66 } 60 }
67 61
68 void operator()(const std::string& s, std::ostream& out) const { 62 void operator()(const std::string& s, std::ostream& out) const {
69 out << " -D"; 63 out << " -D";
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 "\n" 992 "\n"
999 "In the latter case, either rename one of the files or move one of\n" 993 "In the latter case, either rename one of the files or move one of\n"
1000 "the sources to a separate source_set to avoid them both being in\n" 994 "the sources to a separate source_set to avoid them both being in\n"
1001 "the same target."); 995 "the same target.");
1002 g_scheduler->FailWithError(err); 996 g_scheduler->FailWithError(err);
1003 return false; 997 return false;
1004 } 998 }
1005 } 999 }
1006 return true; 1000 return true;
1007 } 1001 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698