From fe4fda82a5557b29005176169ab95806eb9e64ba Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Mon, 18 Nov 2013 13:21:26 -0500 Subject: [PATCH] Bug 937201 - Fix Windows builds without MOZ_ENABLE_PROFILER_SPS. r=BenWa --- toolkit/components/telemetry/Telemetry.cpp | 3 +-- xpcom/build/PoisonIOInterposer.h | 11 ++--------- xpcom/build/PoisonIOInterposerStub.cpp | 18 ++++++++++++++++++ xpcom/build/moz.build | 17 +++++++++++------ 4 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 xpcom/build/PoisonIOInterposerStub.cpp diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 0d47e2226fd9..6c285843bfdc 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -2128,8 +2128,7 @@ RecordShutdownEndTimeStamp() { // calling _exit, but on a debug build or when the user forces a full // shutdown this is called as late as possible, so we have to // white list this write as write poisoning will be enabled. - int fd = fileno(f); - MozillaRegisterDebugFD(fd); + MozillaRegisterDebugFILE(f); TimeStamp now = TimeStamp::Now(); MOZ_ASSERT(now >= gRecordedShutdownStartTime); diff --git a/xpcom/build/PoisonIOInterposer.h b/xpcom/build/PoisonIOInterposer.h index 8a20c347e392..87fb932fc3f1 100644 --- a/xpcom/build/PoisonIOInterposer.h +++ b/xpcom/build/PoisonIOInterposer.h @@ -10,8 +10,6 @@ #include "mozilla/Types.h" #include -#if defined(MOZ_ENABLE_PROFILER_SPS) && (defined(XP_WIN) || defined(XP_MACOSX)) - MOZ_BEGIN_EXTERN_C /** Register file descriptor to be ignored by poisoning IO interposer */ @@ -28,6 +26,8 @@ void MozillaUnRegisterDebugFILE(FILE *f); MOZ_END_EXTERN_C +#if defined(MOZ_ENABLE_PROFILER_SPS) && (defined(XP_WIN) || defined(XP_MACOSX)) + #ifdef __cplusplus namespace mozilla { @@ -65,13 +65,6 @@ void ClearPoisonIOInterposer(); #else /* MOZ_ENABLE_PROFILER_SPS && (XP_WIN || XP_MACOSX) */ -MOZ_BEGIN_EXTERN_C -inline void MozillaRegisterDebugFD(int fd){} -inline void MozillaRegisterDebugFILE(FILE *f){} -inline void MozillaUnRegisterDebugFD(int fd){} -inline void MozillaUnRegisterDebugFILE(FILE *f){} -MOZ_END_EXTERN_C - #ifdef __cplusplus namespace mozilla { inline bool IsDebugFile(intptr_t aFileID){ return true; } diff --git a/xpcom/build/PoisonIOInterposerStub.cpp b/xpcom/build/PoisonIOInterposerStub.cpp new file mode 100644 index 000000000000..addca3b1d76a --- /dev/null +++ b/xpcom/build/PoisonIOInterposerStub.cpp @@ -0,0 +1,18 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 ci et: */ +/* 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 + +extern "C" { + + // Define empty implementations so we can compile when + // MOZ_ENABLE_PROFILER_SPS is undefined + void MozillaRegisterDebugFD(int fd) {} + void MozillaRegisterDebugFILE(FILE *f) {} + void MozillaUnRegisterDebugFD(int fd) {} + void MozillaUnRegisterDebugFILE(FILE *f) {} + +} \ No newline at end of file diff --git a/xpcom/build/moz.build b/xpcom/build/moz.build index fb2c834cad34..28a2c5894d25 100644 --- a/xpcom/build/moz.build +++ b/xpcom/build/moz.build @@ -27,17 +27,22 @@ EXPORTS.mozilla += [ if CONFIG['OS_ARCH'] == 'WINNT': EXPORTS.mozilla += ['perfprobe.h'] - SOURCES += [ - 'perfprobe.cpp', - 'PoisonIOInterposerBase.cpp', - 'PoisonIOInterposerWin.cpp', - ] -elif CONFIG['OS_ARCH'] == 'Darwin': + SOURCES += ['perfprobe.cpp'] + if CONFIG['MOZ_ENABLE_PROFILER_SPS']: + SOURCES += [ + 'PoisonIOInterposerBase.cpp', + 'PoisonIOInterposerWin.cpp', + ] + else: + SOURCES += ['PoisonIOInterposerStub.cpp'] +elif CONFIG['OS_ARCH'] == 'Darwin' and CONFIG['MOZ_ENABLE_PROFILER_SPS']: SOURCES += [ 'mach_override.c', 'PoisonIOInterposerBase.cpp', 'PoisonIOInterposerMac.cpp', ] +else: + SOURCES += ['PoisonIOInterposerStub.cpp'] include('../glue/objs.mozbuild')