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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 165873004: Make Linux GN build's cflags match GYP's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/config/linux/pkg-config.py » ('j') | 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 if (cpu_arch == "arm") { 6 if (cpu_arch == "arm") {
7 import("//build/config/arm.gni") 7 import("//build/config/arm.gni")
8 } 8 }
9 9
10 # compiler --------------------------------------------------------------------- 10 # compiler ---------------------------------------------------------------------
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 # precendence for now. 157 # precendence for now.
158 # TODO(brettw) common.gypi has this only for target toolset. 158 # TODO(brettw) common.gypi has this only for target toolset.
159 #"-Wl,--icf=safe", 159 #"-Wl,--icf=safe",
160 "-Wl,--icf=none", 160 "-Wl,--icf=none",
161 161
162 # Experimentation found that using four linking threads 162 # Experimentation found that using four linking threads
163 # saved ~20% of link time. 163 # saved ~20% of link time.
164 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr ead/thread/281527606915bb36 164 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr ead/thread/281527606915bb36
165 # Only apply this to the target linker, since the host 165 # Only apply this to the target linker, since the host
166 # linker might not be gold, but isn't used much anyway. 166 # linker might not be gold, but isn't used much anyway.
167 "-Wl,--threads", 167 # TODO(raymes): Disable threading because gold is frequently
168 "-Wl,--thread-count=4", 168 # crashing on the bots: crbug.com/161942.
169 #"-Wl,--threads",
170 #"-Wl,--thread-count=4",
169 ] 171 ]
170 } 172 }
171 173
172 ldflags += [ 174 ldflags += [
173 "-fPIC", 175 "-fPIC",
174 "-pthread", 176 "-pthread",
175 "-Wl,-z,noexecstack", 177 "-Wl,-z,noexecstack",
176 "-Wl,-z,now", 178 "-Wl,-z,now",
177 "-Wl,-z,relro", 179 "-Wl,-z,relro",
178 ] 180 ]
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 ] 392 ]
391 393
392 # TODO(brettw) this should also be enabled on Linux but some files 394 # TODO(brettw) this should also be enabled on Linux but some files
393 # currently fail. 395 # currently fail.
394 if (is_mac) { 396 if (is_mac) {
395 cflags += [ "-Wextra" ] 397 cflags += [ "-Wextra" ]
396 } 398 }
397 } 399 }
398 } 400 }
399 config("no_chromium_code") { 401 config("no_chromium_code") {
402 cflags = []
403 cflags_cc = []
404 defines = []
405
400 if (is_win) { 406 if (is_win) {
401 cflags = [ 407 cflags += [
402 "/W3", # Warning level 3. 408 "/W3", # Warning level 3.
403 "/wd4800", # Disable warning when forcing value to bool. 409 "/wd4800", # Disable warning when forcing value to bool.
404 ] 410 ]
405 defines = [ 411 defines += [
406 "_CRT_NONSTDC_NO_WARNINGS", 412 "_CRT_NONSTDC_NO_WARNINGS",
407 "_CRT_NONSTDC_NO_DEPRECATE", 413 "_CRT_NONSTDC_NO_DEPRECATE",
408 ] 414 ]
409 } 415 }
410 416
417 if (is_linux) {
418 # Don't warn about ignoring the return value from e.g. close(). This is
419 # off by default in some gccs but on by default in others. BSD systems do
420 # not support this option, since they are usually using gcc 4.2.1, which
421 # does not have this flag yet.
422 cflags += [ "-Wno-unused-result" ]
423 }
424
425 if (is_linux || is_android) {
426 cflags += [
427 # Don't warn about printf format problems. This is off by default in gcc
428 # but on in Ubuntu's gcc(!).
429 "-Wno-format",
430 ]
431 cflags_cc += [
432 # Don't warn about hash_map in third-party code.
433 "-Wno-deprecated",
434 ]
435 }
436
411 if (is_android_webview_build) { 437 if (is_android_webview_build) {
412 # There is a class of warning which: 438 # There is a class of warning which:
413 # 1) Android always enables and also treats as errors 439 # 1) Android always enables and also treats as errors
414 # 2) Chromium ignores in third party code 440 # 2) Chromium ignores in third party code
415 # So we re-enable those warnings when building Android. 441 # So we re-enable those warnings when building Android.
416 cflags = [ 442 cflags += [
417 "-Wno-address", 443 "-Wno-address",
418 "-Wno-format-security", 444 "-Wno-format-security",
419 "-Wno-return-type", 445 "-Wno-return-type",
420 "-Wno-sequence-point", 446 "-Wno-sequence-point",
421 ] 447 ]
422 cflags_cc = [ "-Wno-non-virtual-dtor" ] 448 cflags_cc += [ "-Wno-non-virtual-dtor" ]
423 } 449 }
424 } 450 }
425 451
426 # rtti ------------------------------------------------------------------------ 452 # rtti ------------------------------------------------------------------------
427 # 453 #
428 # Allows turning Run-Time Type Identification on or off. 454 # Allows turning Run-Time Type Identification on or off.
429 455
430 config("rtti") { 456 config("rtti") {
431 if (is_win) { 457 if (is_win) {
432 cflags_cc = [ "/GR" ] 458 cflags_cc = [ "/GR" ]
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 ] 507 ]
482 } else { 508 } else {
483 # Common GCC warning setup. 509 # Common GCC warning setup.
484 cflags = [ 510 cflags = [
485 # Enables. 511 # Enables.
486 "-Wendif-labels", # Weird old-style text after an #endif. 512 "-Wendif-labels", # Weird old-style text after an #endif.
487 513
488 # Disables. 514 # Disables.
489 "-Wno-missing-field-initializers", # "struct foo f = {0};" 515 "-Wno-missing-field-initializers", # "struct foo f = {0};"
490 "-Wno-unused-parameter", # Unused function parameters. 516 "-Wno-unused-parameter", # Unused function parameters.
491 "-Wno-write-strings",
492 ] 517 ]
493 518
494 if (is_mac) { 519 if (is_mac) {
495 cflags += [ 520 cflags += [
496 "-Wnewline-eof", 521 "-Wnewline-eof",
497 ] 522 ]
498 } 523 }
499 524
500 # TODO(brettw) Ones below here should be clang-only when we have a flag 525 # TODO(brettw) Ones below here should be clang-only when we have a flag
501 # for it. 526 # for it.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 cflags = [ "-g1" ] 678 cflags = [ "-g1" ]
654 } 679 }
655 } 680 }
656 681
657 config("no_symbols") { 682 config("no_symbols") {
658 if (!is_win) { 683 if (!is_win) {
659 cflags = [ "-g0" ] 684 cflags = [ "-g0" ]
660 } 685 }
661 } 686 }
662 687
OLDNEW
« no previous file with comments | « no previous file | build/config/linux/pkg-config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698