OLD | NEW |
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 <cstring> | 7 #include <cstring> |
8 #include <set> | 8 #include <set> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 bool has_precompiled_headers = | 415 bool has_precompiled_headers = |
416 target_->config_values().has_precompiled_headers(); | 416 target_->config_values().has_precompiled_headers(); |
417 | 417 |
418 EscapeOptions opts = GetFlagOptions(); | 418 EscapeOptions opts = GetFlagOptions(); |
419 if (used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) { | 419 if (used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) { |
420 WriteOneFlag(SUBSTITUTION_ASMFLAGS, false, Toolchain::TYPE_NONE, | 420 WriteOneFlag(SUBSTITUTION_ASMFLAGS, false, Toolchain::TYPE_NONE, |
421 &ConfigValues::asmflags, opts); | 421 &ConfigValues::asmflags, opts); |
422 } | 422 } |
| 423 // TODO(andybons): Remove SOURCE_S and SOURCE_ASM checks once asmflags is |
| 424 // used. |
423 if (used_types.Get(SOURCE_C) || used_types.Get(SOURCE_CPP) || | 425 if (used_types.Get(SOURCE_C) || used_types.Get(SOURCE_CPP) || |
424 used_types.Get(SOURCE_M) || used_types.Get(SOURCE_MM)) { | 426 used_types.Get(SOURCE_M) || used_types.Get(SOURCE_MM) || |
| 427 used_types.Get(SOURCE_S) || used_types.Get(SOURCE_ASM)) { |
425 WriteOneFlag(SUBSTITUTION_CFLAGS, false, Toolchain::TYPE_NONE, | 428 WriteOneFlag(SUBSTITUTION_CFLAGS, false, Toolchain::TYPE_NONE, |
426 &ConfigValues::cflags, opts); | 429 &ConfigValues::cflags, opts); |
427 } | 430 } |
428 if (used_types.Get(SOURCE_C)) { | 431 if (used_types.Get(SOURCE_C) || used_types.Get(SOURCE_S) || |
| 432 used_types.Get(SOURCE_ASM)) { |
429 WriteOneFlag(SUBSTITUTION_CFLAGS_C, has_precompiled_headers, | 433 WriteOneFlag(SUBSTITUTION_CFLAGS_C, has_precompiled_headers, |
430 Toolchain::TYPE_CC, &ConfigValues::cflags_c, opts); | 434 Toolchain::TYPE_CC, &ConfigValues::cflags_c, opts); |
431 } | 435 } |
432 if (used_types.Get(SOURCE_CPP)) { | 436 if (used_types.Get(SOURCE_CPP)) { |
433 WriteOneFlag(SUBSTITUTION_CFLAGS_CC, has_precompiled_headers, | 437 WriteOneFlag(SUBSTITUTION_CFLAGS_CC, has_precompiled_headers, |
434 Toolchain::TYPE_CXX, &ConfigValues::cflags_cc, opts); | 438 Toolchain::TYPE_CXX, &ConfigValues::cflags_cc, opts); |
435 } | 439 } |
436 if (used_types.Get(SOURCE_M)) { | 440 if (used_types.Get(SOURCE_M)) { |
437 WriteOneFlag(SUBSTITUTION_CFLAGS_OBJC, has_precompiled_headers, | 441 WriteOneFlag(SUBSTITUTION_CFLAGS_OBJC, has_precompiled_headers, |
438 Toolchain::TYPE_OBJC, &ConfigValues::cflags_objc, opts); | 442 Toolchain::TYPE_OBJC, &ConfigValues::cflags_objc, opts); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 "\n" | 1032 "\n" |
1029 "In the latter case, either rename one of the files or move one of\n" | 1033 "In the latter case, either rename one of the files or move one of\n" |
1030 "the sources to a separate source_set to avoid them both being in\n" | 1034 "the sources to a separate source_set to avoid them both being in\n" |
1031 "the same target."); | 1035 "the same target."); |
1032 g_scheduler->FailWithError(err); | 1036 g_scheduler->FailWithError(err); |
1033 return false; | 1037 return false; |
1034 } | 1038 } |
1035 } | 1039 } |
1036 return true; | 1040 return true; |
1037 } | 1041 } |
OLD | NEW |