Bug 754198 - Warning treated as error in jemalloc.c. Build busted. [r=jlebar,bsmedberg]

This commit is contained in:
Fabrice Desré 2012-05-11 12:34:24 -07:00
parent 1e48990636
commit 5397f4846a
11 changed files with 45 additions and 22 deletions

View File

@ -1234,10 +1234,10 @@ main(int argc, char *argv[])
munmap(mapping, size); munmap(mapping, size);
ftruncate(fd, size - hole_len); int result = ftruncate(fd, size - hole_len);
close(fd); close(fd);
return 0; return result == -1 ? 1 : 0;
} }

View File

@ -1354,12 +1354,12 @@ NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
FILE *file = fopen(fname, "rb"); FILE *file = fopen(fname, "rb");
if (file) { if (file) {
fseek(file, 0, SEEK_END); ssize_t unused = fseek(file, 0, SEEK_END);
size = ftell(file); size = ftell(file);
instanceData->fileBuf = malloc((int32_t)size + 1); instanceData->fileBuf = malloc((int32_t)size + 1);
char* buf = reinterpret_cast<char *>(instanceData->fileBuf); char* buf = reinterpret_cast<char *>(instanceData->fileBuf);
fseek(file, 0, SEEK_SET); unused = fseek(file, 0, SEEK_SET);
fread(instanceData->fileBuf, 1, size, file); unused = fread(instanceData->fileBuf, 1, size, file);
fclose(file); fclose(file);
buf[size] = '\0'; buf[size] = '\0';
instanceData->fileBufSize = (int32_t)size; instanceData->fileBufSize = (int32_t)size;

View File

@ -1527,10 +1527,11 @@ wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4)
#if defined(MOZ_MEMORY) && !defined(MOZ_MEMORY_WINDOWS) #if defined(MOZ_MEMORY) && !defined(MOZ_MEMORY_WINDOWS)
#define _write write #define _write write
#endif #endif
_write(STDERR_FILENO, p1, (unsigned int) strlen(p1)); int res;
_write(STDERR_FILENO, p2, (unsigned int) strlen(p2)); res = _write(STDERR_FILENO, p1, (unsigned int) strlen(p1));
_write(STDERR_FILENO, p3, (unsigned int) strlen(p3)); res = _write(STDERR_FILENO, p2, (unsigned int) strlen(p2));
_write(STDERR_FILENO, p4, (unsigned int) strlen(p4)); res = _write(STDERR_FILENO, p3, (unsigned int) strlen(p3));
res = _write(STDERR_FILENO, p4, (unsigned int) strlen(p4));
} }
#define _malloc_message malloc_message #define _malloc_message malloc_message

View File

@ -126,7 +126,9 @@ int main(int argc, char **argv) {
break; break;
/* -C workingdirectory */ /* -C workingdirectory */
} else if (argv[1][0] == '-' && argv[1][1] == 'C') { } else if (argv[1][0] == '-' && argv[1][1] == 'C') {
chdir(argv[2]); int res = chdir(argv[2]);
if (res == -1)
return -1;
argv += 2; argv += 2;
argc -= 2; argc -= 2;
} }

View File

@ -88,6 +88,10 @@
#include "prlog.h" #include "prlog.h"
#include "prtime.h" #include "prtime.h"
#include "mozilla/unused.h"
using mozilla::unused;
namespace TestProtocols { namespace TestProtocols {
#if defined(PR_LOGGING) #if defined(PR_LOGGING)
@ -338,7 +342,7 @@ TestAuthPrompt::PromptUsernameAndPassword(const PRUnichar *dialogTitle,
int n; int n;
printf("Enter username: "); printf("Enter username: ");
fgets(buf, sizeof(buf), stdin); unused << fgets(buf, sizeof(buf), stdin);
n = strlen(buf); n = strlen(buf);
buf[n-1] = '\0'; // trim trailing newline buf[n-1] = '\0'; // trim trailing newline
*user = NS_StringCloneData(NS_ConvertUTF8toUTF16(buf)); *user = NS_StringCloneData(NS_ConvertUTF8toUTF16(buf));
@ -824,7 +828,7 @@ nsresult LoadURLFromConsole()
{ {
char buffer[1024]; char buffer[1024];
printf("Enter URL (\"q\" to start): "); printf("Enter URL (\"q\" to start): ");
scanf("%s", buffer); unused << scanf("%s", buffer);
if (buffer[0]=='q') if (buffer[0]=='q')
gAskUserForInput = false; gAskUserForInput = false;
else else

View File

@ -66,9 +66,11 @@
#include "keyt.h" #include "keyt.h"
#include "ssl.h" #include "ssl.h"
#include "plhash.h" #include "plhash.h"
#include "mozilla/unused.h"
using std::string; using std::string;
using std::vector; using std::vector;
using mozilla::unused;
#define IS_DELIM(m, c) ((m)[(c) >> 3] & (1 << ((c) & 7))) #define IS_DELIM(m, c) ((m)[(c) >> 3] & (1 << ((c) & 7)))
#define SET_DELIM(m, c) ((m)[(c) >> 3] |= (1 << ((c) & 7))) #define SET_DELIM(m, c) ((m)[(c) >> 3] |= (1 << ((c) & 7)))
@ -1264,7 +1266,7 @@ int parseConfigFile(const char* filePath)
while (!feof(f)) while (!feof(f))
{ {
char c; char c;
fscanf(f, "%c", &c); unused << fscanf(f, "%c", &c);
switch (c) switch (c)
{ {
case '\n': case '\n':

View File

@ -65,6 +65,10 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#include "mozilla/unused.h"
using mozilla::unused;
namespace mozilla { namespace mozilla {
namespace widget { namespace widget {
// the read end of the pipe, which will be used by GfxInfo // the read end of the pipe, which will be used by GfxInfo
@ -90,8 +94,8 @@ static func_ptr_type cast(void *ptr)
static void fatal_error(const char *str) static void fatal_error(const char *str)
{ {
write(write_end_of_the_pipe, str, strlen(str)); unused << write(write_end_of_the_pipe, str, strlen(str));
write(write_end_of_the_pipe, "\n", 1); unused << write(write_end_of_the_pipe, "\n", 1);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -105,7 +109,7 @@ x_error_handler(Display *, XErrorEvent *ev)
ev->error_code, ev->error_code,
ev->request_code, ev->request_code,
ev->minor_code); ev->minor_code);
write(write_end_of_the_pipe, buf, length); unused << write(write_end_of_the_pipe, buf, length);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
return 0; return 0;
} }
@ -253,7 +257,7 @@ static void glxtest()
dlclose(libgl); dlclose(libgl);
///// Finally write data to the pipe ///// Finally write data to the pipe
write(write_end_of_the_pipe, buf, length); unused << write(write_end_of_the_pipe, buf, length);
} }
/** \returns true in the child glxtest process, false in the parent process */ /** \returns true in the child glxtest process, false in the parent process */

View File

@ -46,6 +46,9 @@
#include "prlog.h" #include "prlog.h"
#include "prenv.h" #include "prenv.h"
#include "mozilla/HangMonitor.h" #include "mozilla/HangMonitor.h"
#include "mozilla/unused.h"
using mozilla::unused;
#define NOTIFY_TOKEN 0xFA #define NOTIFY_TOKEN 0xFA
@ -76,7 +79,7 @@ nsAppShell::EventProcessorCallback(GIOChannel *source,
nsAppShell *self = static_cast<nsAppShell *>(data); nsAppShell *self = static_cast<nsAppShell *>(data);
unsigned char c; unsigned char c;
read(self->mPipeFDs[0], &c, 1); ssize_t ununsed = read(self->mPipeFDs[0], &c, 1);
NS_ASSERTION(c == (unsigned char) NOTIFY_TOKEN, "wrong token"); NS_ASSERTION(c == (unsigned char) NOTIFY_TOKEN, "wrong token");
self->NativeEventCallback(); self->NativeEventCallback();
@ -153,7 +156,7 @@ void
nsAppShell::ScheduleNativeEventCallback() nsAppShell::ScheduleNativeEventCallback()
{ {
unsigned char buf[] = { NOTIFY_TOKEN }; unsigned char buf[] = { NOTIFY_TOKEN };
write(mPipeFDs[1], buf, 1); unused << write(mPipeFDs[1], buf, 1);
} }
bool bool

View File

@ -46,6 +46,9 @@
#include "nsTHashtable.h" #include "nsTHashtable.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include <stdio.h> #include <stdio.h>
#include "mozilla/unused.h"
using mozilla::unused;
namespace mozilla { namespace mozilla {
namespace MapsMemoryReporter { namespace MapsMemoryReporter {
@ -339,7 +342,7 @@ MapsReporter::ParseMapping(
devMinor, &inode, path); devMinor, &inode, path);
// Eat up any whitespace at the end of this line, including the newline. // Eat up any whitespace at the end of this line, including the newline.
fscanf(aFile, " "); unused << fscanf(aFile, " ");
// We might or might not have a path, but the rest of the arguments should be // We might or might not have a path, but the rest of the arguments should be
// there. // there.

View File

@ -1366,7 +1366,9 @@ public:
// Therefore we need to call the APIs directly. // Therefore we need to call the APIs directly.
GetTempPathA(mozilla::ArrayLength(basename), basename); GetTempPathA(mozilla::ArrayLength(basename), basename);
#else #else
tmpnam(basename); char *tmp = tmpnam(basename);
if (!tmp)
return NS_ERROR_FAILURE;
char *lastSlash = strrchr(basename, XPCOM_FILE_PATH_SEPARATOR[0]); char *lastSlash = strrchr(basename, XPCOM_FILE_PATH_SEPARATOR[0]);
if (lastSlash) { if (lastSlash) {
*lastSlash = '\0'; *lastSlash = '\0';

View File

@ -47,6 +47,7 @@
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "mozilla/HangMonitor.h" #include "mozilla/HangMonitor.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/unused.h"
#define HAVE_UALARM _BSD_SOURCE || (_XOPEN_SOURCE >= 500 || \ #define HAVE_UALARM _BSD_SOURCE || (_XOPEN_SOURCE >= 500 || \
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \ _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \
@ -72,6 +73,7 @@
#endif #endif
using namespace mozilla; using namespace mozilla;
using mozilla::unused;
#ifdef PR_LOGGING #ifdef PR_LOGGING
static PRLogModuleInfo *sLog = PR_NewLogModule("nsThread"); static PRLogModuleInfo *sLog = PR_NewLogModule("nsThread");
@ -568,7 +570,7 @@ void canary_alarm_handler (int signum)
void *array[30]; void *array[30];
const char msg[29] = "event took too long to run:\n"; const char msg[29] = "event took too long to run:\n";
// use write to be safe in the signal handler // use write to be safe in the signal handler
write(Canary::sOutputFD, msg, sizeof(msg)); unused << write(Canary::sOutputFD, msg, sizeof(msg));
backtrace_symbols_fd(array, backtrace(array, 30), Canary::sOutputFD); backtrace_symbols_fd(array, backtrace(array, 30), Canary::sOutputFD);
} }