Bug 1534878 - xpcom: #include headers for global functions' declarations. r=erahm
authorChris Peterson <cpeterson@mozilla.com>
Thu, 07 Mar 2019 23:32:54 -0800
changeset 525373 25fbad7b3214444a3b07a52880faa61e399309a9
parent 525372 5ff84e853d700af894616574f581551a88a93dc7
child 525374 710481a0ddfa6826b5d06e93d683547f4da97402
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1534878
milestone67.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 1534878 - xpcom: #include headers for global functions' declarations. r=erahm clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). The .cpp files defining these functions did not include the headers with the corresponding function prototypes used by other compilation units. Including a header file in its corresponding .cpp file can help catch mismatched declarations and definitions. xpcom/components/nsCategoryManager.cpp:637:6 [-Wmissing-prototypes] no previous prototype for function 'NS_CreateServicesFromCategory' xpcom/io/nsPipe3.cpp:1824:10 [-Wmissing-prototypes] no previous prototype for function 'nsPipeConstructor' xpcom/io/nsStringStream.cpp:475:10 [-Wmissing-prototypes] no previous prototype for function 'nsStringInputStreamConstructor' xpcom/threads/ThreadDelay.cpp:18:6 [-Wmissing-prototypes] no previous prototype for function 'DelayForChaosMode' Differential Revision: https://phabricator.services.mozilla.com/D23265
xpcom/components/nsCategoryManager.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsStringStream.cpp
xpcom/threads/ThreadDelay.cpp
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-#include "nsICategoryManager.h"
 #include "nsCategoryManager.h"
+#include "nsCategoryManagerUtils.h"
 
 #include "prio.h"
 #include "prlock.h"
 #include "nsArrayEnumerator.h"
 #include "nsCOMPtr.h"
 #include "nsTHashtable.h"
 #include "nsClassHashtable.h"
 #include "nsIFactory.h"
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -17,16 +17,17 @@
 #include "nsSegmentedBuffer.h"
 #include "nsStreamUtils.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "mozilla/Logging.h"
 #include "nsIClassInfoImpl.h"
 #include "nsAlgorithm.h"
 #include "nsMemory.h"
+#include "nsPipe.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 
 using namespace mozilla;
 
 #ifdef LOG
 #  undef LOG
 #endif
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -19,16 +19,17 @@
 #include "nsCRT.h"
 #include "prerror.h"
 #include "plstr.h"
 #include "nsIClassInfoImpl.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "nsIIPCSerializableInputStream.h"
+#include "XPCOMModule.h"
 
 using namespace mozilla::ipc;
 using mozilla::Maybe;
 using mozilla::Some;
 
 //-----------------------------------------------------------------------------
 // nsIStringInputStream implementation
 //-----------------------------------------------------------------------------
--- a/xpcom/threads/ThreadDelay.cpp
+++ b/xpcom/threads/ThreadDelay.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
+#include "ThreadDelay.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/ChaosMode.h"
 
 #if defined(XP_WIN)
 #  include <windows.h>
 #else
 #  include <unistd.h>
 #endif