Bug 1017110 - Suppress warnings in third-party code: libstagefright. r=cajbir
authorChris Peterson <cpeterson@mozilla.com>
Mon, 26 May 2014 22:31:34 -0700
changeset 205458 29d2b976dcb5cf015c30665a7206d4a6797e76bf
parent 205457 ff08d9bb2da1ac743e1a7c6b0ab5e75cf6050030
child 205459 a456dc7f19c4bdb85151f997a0cc533aa710651d
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1017110
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1017110 - Suppress warnings in third-party code: libstagefright. r=cajbir
media/libstagefright/binding/Adts.cpp
media/libstagefright/moz.build
--- a/media/libstagefright/binding/Adts.cpp
+++ b/media/libstagefright/binding/Adts.cpp
@@ -36,17 +36,17 @@ bool
 Adts::ConvertEsdsToAdts(uint16_t aChannelCount, int8_t aFrequencyIndex,
                         int8_t aProfile, MP4Sample* aSample)
 {
   static const int kADTSHeaderSize = 7;
 
   size_t newSize = aSample->size + kADTSHeaderSize;
 
   // ADTS header uses 13 bits for packet size.
-  if (newSize >= (1 << 13) || aChannelCount < 0 || aChannelCount > 15 ||
+  if (newSize >= (1 << 13) || aChannelCount > 15 ||
       aFrequencyIndex < 0 || aProfile < 1 || aProfile > 4)
     return false;
 
   Array<uint8_t, kADTSHeaderSize> header;
   header[0] = 0xff;
   header[1] = 0xf1;
   header[2] =
     ((aProfile - 1) << 6) + (aFrequencyIndex << 2) + (aChannelCount >> 2);
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -25,28 +25,16 @@ elif CONFIG['OS_TARGET'] in ('DragonFly'
         DEFINES['ENODATA'] = '-0x80000003'
     if CONFIG['OS_TARGET'] == 'OpenBSD':
         DEFINES['EBADMSG'] = '-0x80000006'
     DEFINES['HAVE_SYS_UIO_H'] = True
     DEFINES['off64_t'] = 'off_t'
     LOCAL_INCLUDES += [ 'ports/bsd/include' ]
 else:
     DEFINES['HAVE_SYS_UIO_H'] = True
-    if CONFIG['OS_TARGET'] == 'Linux':
-        CXXFLAGS += ['-Wno-deprecated',
-                     '-Wno-format',
-                     '-Wno-dynamic-class-memaccess',
-                     '-Wno-tautological-compare',
-                     '-Wno-tautological-constant-out-of-range-compare',
-                     '-Wno-unused-variable',
-                     '-Wno-unused-function',
-                     '-Wno-sign-compare',
-                     '-Wno-comment',
-                     '-Wno-incompatible-pointer-types-discards-qualifiers'
-        ]
 
 if CONFIG['OS_TARGET'] != 'Android':
     DEFINES['FAKE_LOG_DEVICE'] = True
     SOURCES += [
         'system/core/liblog/fake_log_device.c',
     ]
     UNIFIED_SOURCES += [
         'system/core/libcutils/strdup16to8.c',
@@ -100,8 +88,37 @@ LOCAL_INCLUDES += [
     'frameworks/av/media/libstagefright/',
     'stubs/empty',
     'stubs/include',
     'stubs/include/media/stagefright/foundation',
     'system/core/include',
 ]
 
 FINAL_LIBRARY = 'gklayout'
+
+# Suppress warnings in third-party code.
+if CONFIG['_MSC_VER']:
+    CFLAGS += [
+        '-wd4013', # 'function' undefined; assuming extern returning int
+        '-wd4101', # unreferenced local variable
+    ]
+    CXXFLAGS += [
+        '-wd4018', # '<' : signed/unsigned mismatch
+        '-wd4275', # non dll-interface class used as base for dll-interface class
+        '-wd4305', # '=' : truncation from 'double' to 'float'
+        '-wd4309', # '=' : truncation of constant value
+        '-wd4355', # 'this' : used in base member initializer list
+        '-wd4804', # '>' : unsafe use of type 'bool' in operation
+    ]
+elif CONFIG['GNU_CXX']:
+    CFLAGS += [
+        '-Wno-comment',
+        '-Wno-declaration-after-statement',
+        '-Wno-sign-compare'
+    ]
+    CXXFLAGS += [
+        '-Wno-format',
+        '-Wno-multichar',
+        '-Wno-sign-compare',
+        '-Wno-unused',
+    ]
+    if CONFIG['CLANG_CXX']:
+        CXXFLAGS += ['-Wno-tautological-constant-out-of-range-compare']