From 301f8c134d4cd5e3647872e96f4f74458fd9ccdc Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Wed, 2 Jul 2014 09:58:40 -0700 Subject: [PATCH] Enable more compilation checks in clang These checks were disabled in Chromium due to historical reason. Also fix compilation errors as a result of the above mentioned change. Change-Id: I5d240f2f11aa5920598f954d696a15bdcbf78fd8 --- common.gypi | 33 +++++++++++++++++++++++++++++++++ media/base/container_names.cc | 8 +++++--- media/base/media_base.gyp | 12 +++--------- media/event/media_event.gyp | 12 +++--------- media/file/file.gyp | 12 +++--------- media/filters/filters.gyp | 12 +++--------- media/formats/mp2t/mp2t.gyp | 12 +++--------- media/formats/mp4/mp4.gyp | 12 +++--------- media/formats/mpeg/mpeg.gyp | 12 +++--------- media/test/media_test.gyp | 12 +++--------- mpd/mpd.gyp | 12 +++--------- packager.gyp | 12 +++--------- 12 files changed, 68 insertions(+), 93 deletions(-) create mode 100644 common.gypi diff --git a/common.gypi b/common.gypi new file mode 100644 index 0000000000..5d477fbd57 --- /dev/null +++ b/common.gypi @@ -0,0 +1,33 @@ +# Copyright 2014 Google Inc. All rights reserved. +# +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file or at +# https://developers.google.com/open-source/licenses/bsd +# +# This file contains common settings for building packager components. + +{ + 'variables': { + # Compile as Chromium code to enable warnings and warnings-as-errors. + 'chromium_code': 1, + }, + 'target_defaults': { + 'include_dirs': [ + '.', + ], + 'conditions': [ + ['clang==1', { + # Revert the relevant settings in Chromium's common.gypi. + 'cflags!': [ + '-Wno-char-subscripts', + '-Wno-unneeded-internal-declaration', + '-Wno-covered-switch-default', + + # C++11-related flags: + '-Wno-c++11-narrowing', + '-Wno-reserved-user-defined-literal', + ], + }], + ], + }, +} diff --git a/media/base/container_names.cc b/media/base/container_names.cc index 331fbde29d..3cad5b6e57 100644 --- a/media/base/container_names.cc +++ b/media/base/container_names.cc @@ -13,9 +13,11 @@ namespace media { -#define TAG(a, b, c, d) \ - ((static_cast(a) << 24) | (static_cast(b) << 16) | \ - (static_cast(c) << 8) | (static_cast(d))) +#define TAG(a, b, c, d) \ + ((static_cast(static_cast(a)) << 24) | \ + (static_cast(b) << 16) | \ + (static_cast(c) << 8) | \ + (static_cast(d))) #define RCHECK(x) \ do { \ diff --git a/media/base/media_base.gyp b/media/base/media_base.gyp index 2f86d44005..730ec0fc06 100644 --- a/media/base/media_base.gyp +++ b/media/base/media_base.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../..', - ], - }, + 'includes': [ + '../../common.gypi', + ], 'targets': [ { 'target_name': 'base', diff --git a/media/event/media_event.gyp b/media/event/media_event.gyp index f24da45195..61adf3fff1 100644 --- a/media/event/media_event.gyp +++ b/media/event/media_event.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../..', - ], - }, + 'includes': [ + '../../common.gypi', + ], 'targets': [ { 'target_name': 'media_event', diff --git a/media/file/file.gyp b/media/file/file.gyp index 44859ba6b7..8e46c4104a 100644 --- a/media/file/file.gyp +++ b/media/file/file.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../..', - ], - }, + 'includes': [ + '../../common.gypi', + ], 'targets': [ { 'target_name': 'file', diff --git a/media/filters/filters.gyp b/media/filters/filters.gyp index 81e490bf1c..0e485f2f35 100644 --- a/media/filters/filters.gyp +++ b/media/filters/filters.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../..', - ], - }, + 'includes': [ + '../../common.gypi', + ], 'targets': [ { 'target_name': 'filters', diff --git a/media/formats/mp2t/mp2t.gyp b/media/formats/mp2t/mp2t.gyp index 373029b160..640241ba9f 100644 --- a/media/formats/mp2t/mp2t.gyp +++ b/media/formats/mp2t/mp2t.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../../..', - ], - }, + 'includes': [ + '../../../common.gypi', + ], 'targets': [ { 'target_name': 'mp2t', diff --git a/media/formats/mp4/mp4.gyp b/media/formats/mp4/mp4.gyp index f1495bce66..9727fd461a 100644 --- a/media/formats/mp4/mp4.gyp +++ b/media/formats/mp4/mp4.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../../..', - ], - }, + 'includes': [ + '../../../common.gypi', + ], 'targets': [ { 'target_name': 'mp4', diff --git a/media/formats/mpeg/mpeg.gyp b/media/formats/mpeg/mpeg.gyp index 8f81aa1cfb..1a0c996baf 100644 --- a/media/formats/mpeg/mpeg.gyp +++ b/media/formats/mpeg/mpeg.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../../..', - ], - }, + 'includes': [ + '../../../common.gypi', + ], 'targets': [ { 'target_name': 'mpeg', diff --git a/media/test/media_test.gyp b/media/test/media_test.gyp index b5c3f742f1..322bf18603 100644 --- a/media/test/media_test.gyp +++ b/media/test/media_test.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '../..', - ], - }, + 'includes': [ + '../../common.gypi', + ], 'targets': [ { 'target_name': 'run_all_unittests', diff --git a/mpd/mpd.gyp b/mpd/mpd.gyp index d336e76755..35c636fe12 100644 --- a/mpd/mpd.gyp +++ b/mpd/mpd.gyp @@ -7,15 +7,9 @@ # GYP file for any MPD generation targets. { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '..', - ], - }, + 'includes': [ + '../common.gypi', + ], 'targets': [ { 'target_name': 'media_info_proto', diff --git a/packager.gyp b/packager.gyp index 7da0a63a40..cc6c69775e 100644 --- a/packager.gyp +++ b/packager.gyp @@ -5,15 +5,9 @@ # https://developers.google.com/open-source/licenses/bsd { - 'variables': { - # Compile as chromium code to enable warnings and warnings-as-errors. - 'chromium_code': 1, - }, - 'target_defaults': { - 'include_dirs': [ - '.', - ], - }, + 'includes': [ + 'common.gypi', + ], 'targets': [ { 'target_name': 'packager',