Bug 1367834 - Suppress compiler warnings for 3rd party projects; r?froydnj
Most complaints about compiler warnings being printed at the end of the
build (4abe611696ab -
bug 1360764) center around the volume. And most
of the volume is due to 3rd party projects. Since work to suppress the
warnings in 3rd party projects has been slow, let's temporarily filter
out those warnings.
This commit adds a list of suppressed directories corresponding to
3rd party projects responsible for most compiler warnings. For
non-automation builds, we don't print the warnings. Instead, we
print a summary of how many warnings were suppressed.
Not all 3rd party projects were listed. The intent is to only list the
high volume ones so the warnings list is reasonable by default. I
believe the current implementation achieves that. But I wouldn't
be surprised if it requires refinement. Perfect is the enemy of good.
MozReview-Commit-ID: ExDRidsHROC
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1,15 +1,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, # You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import argparse
+import collections
import errno
import itertools
import json
import logging
import operator
import os
import subprocess
import sys
@@ -470,31 +471,65 @@ class Build(MachCommandBase):
# inline output from the compiler itself. However, unlike inline
# output, this list is sorted and grouped by file, making it
# easier to triage output.
#
# Only do this if we had a successful build. If the build failed,
# there are more important things in the log to look for than
# whatever code we warned about.
if not status:
+ # Suppress warnings for 3rd party projects in local builds
+ # until we suppress them for real.
+ # TODO remove entries/feature once we stop generating warnings
+ # in these directories.
+ LOCAL_SUPPRESS_DIRS = (
+ 'gfx/angle',
+ 'gfx/cairo',
+ 'intl/icu/source',
+ 'js/src/ctypes/libffi',
+ 'media/libtheora',
+ 'media/mtransport/third_party/nICEr',
+ 'media/mtransport/third_party/nrappkit',
+ 'media/webrtc/trunk/webrtc',
+ 'netwerk/sctp/src/netinet',
+ 'nsprpub',
+ 'security/nss',
+ )
+
+ suppressed_by_dir = collections.Counter()
+
for warning in sorted(monitor.instance_warnings):
path = mozpath.normsep(warning['filename'])
if path.startswith(self.topsrcdir):
path = path[len(self.topsrcdir) + 1:]
warning['normpath'] = path
+ if (path.startswith(LOCAL_SUPPRESS_DIRS) and
+ 'MOZ_AUTOMATION' not in os.environ):
+ for d in LOCAL_SUPPRESS_DIRS:
+ if path.startswith(d):
+ suppressed_by_dir[d] += 1
+ break
+
+ continue
+
if warning['column'] is not None:
self.log(logging.WARNING, 'compiler_warning', warning,
'warning: {normpath}:{line}:{column} [{flag}] '
'{message}')
else:
self.log(logging.WARNING, 'compiler_warning', warning,
'warning: {normpath}:{line} [{flag}] {message}')
+ for d, count in sorted(suppressed_by_dir.items()):
+ self.log(logging.WARNING, 'suppressed_warning',
+ {'dir': d, 'count': count},
+ '(suppressed {count} warnings in {dir})')
+
monitor.finish(record_usage=status==0)
high_finder, finder_percent = monitor.have_high_finder_usage()
if high_finder:
print(FINDER_SLOW_MESSAGE % finder_percent)
ccache_end = monitor.ccache_stats()