Some GCC 4.1.0 related build fixes (under Linux/PPC).

Doesn't build yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-05-17 20:54:12 +00:00
parent 9046c67753
commit 01fdd314e5
6 changed files with 40 additions and 56 deletions

View File

@ -80,28 +80,6 @@
/* cpp kit */
/* -- <typeinfo> */
class _IMPEXP_ROOT bad_cast;
class _IMPEXP_ROOT bad_typeid;
class _IMPEXP_ROOT type_info;
/* -- <exception> */
class _IMPEXP_ROOT exception;
class _IMPEXP_ROOT bad_exception;
/* -- <new.h> */
class _IMPEXP_ROOT bad_alloc;
/* -- <mexcept.h> */
class _IMPEXP_ROOT logic_error;
class _IMPEXP_ROOT domain_error;
class _IMPEXP_ROOT invalid_argument;
class _IMPEXP_ROOT length_error;
class _IMPEXP_ROOT out_of_range;
class _IMPEXP_ROOT runtime_error;
class _IMPEXP_ROOT range_error;
class _IMPEXP_ROOT overflow_error;
/* support kit */
class _IMPEXP_BE BArchivable;
class _IMPEXP_BE BAutolock;

View File

@ -95,8 +95,8 @@ class _PointerList_ : public BList {
public:
_PointerList_(const _PointerList_ &list);
_PointerList_(int32 itemsPerBlock = 20, bool owning = false);
~_PointerList_();
virtual ~_PointerList_();
typedef void *(* GenericEachFunction)(void *, void *);
typedef int (* GenericCompareFunction)(const void *, const void *);
typedef int (* GenericCompareFunctionWithState)(const void *, const void *,

View File

@ -1,7 +1,12 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//---------------------------------------------------------------------
/*
* Copyright 2002-2006, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Tyler Dauwalder
* Ingo Weinhold, bonefish@users.sf.net
*/
/*!
\file ResourceFile.cpp
ResourceFile implementation.
@ -19,9 +24,7 @@
#include "ResourceItem.h"
#include "ResourcesContainer.h"
#include "ResourcesDefs.h"
//#include "Warnings.h"
using namespace std;
namespace BPrivate {
namespace Storage {
@ -117,7 +120,7 @@ calculate_checksum(const void *data, uint32 size)
const uint8 *current = csData;
for (; current < dataEnd; current += 4) {
uint32 word = 0;
int32 bytes = min(4L, (int32)(dataEnd - current));
int32 bytes = min_c(4L, (int32)(dataEnd - current));
for (int32 i = 0; i < bytes; i++)
word = (word << 8) + current[i];
checkSum += word;
@ -520,8 +523,8 @@ ResourceFile::_InitELFFile(BFile &file)
"table exceeds file: %lu.",
programHeaderTableOffset + programHeaderTableSize);
}
resourceOffset = max(resourceOffset, programHeaderTableOffset
+ programHeaderTableSize);
resourceOffset = max_c(resourceOffset, programHeaderTableOffset
+ programHeaderTableSize);
// iterate through the program headers
for (int32 i = 0; i < (int32)programHeaderCount; i++) {
uint32 shOffset = programHeaderTableOffset + i * programHeaderSize;
@ -545,8 +548,8 @@ ResourceFile::_InitELFFile(BFile &file)
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
"segment exceeds file: %lu.", segmentEnd);
}
resourceOffset = max(resourceOffset, segmentEnd);
resourceAlignment = max(resourceAlignment, alignment);
resourceOffset = max_c(resourceOffset, segmentEnd);
resourceAlignment = max_c(resourceAlignment, alignment);
}
}
}
@ -566,8 +569,8 @@ ResourceFile::_InitELFFile(BFile &file)
"table exceeds file: %lu.",
sectionHeaderTableOffset + sectionHeaderTableSize);
}
resourceOffset = max(resourceOffset, sectionHeaderTableOffset
+ sectionHeaderTableSize);
resourceOffset = max_c(resourceOffset, sectionHeaderTableOffset
+ sectionHeaderTableSize);
// iterate through the section headers
for (int32 i = 0; i < (int32)sectionHeaderCount; i++) {
uint32 shOffset = sectionHeaderTableOffset + i * sectionHeaderSize;
@ -591,7 +594,7 @@ ResourceFile::_InitELFFile(BFile &file)
throw Exception(B_IO_ERROR, "Invalid ELF section header: "
"section exceeds file: %lu.", sectionEnd);
}
resourceOffset = max(resourceOffset, sectionEnd);
resourceOffset = max_c(resourceOffset, sectionEnd);
}
}
}
@ -651,7 +654,7 @@ ResourceFile::_InitPEFFile(BFile &file, const PEFContainerHeader &pefHeader)
throw Exception(B_IO_ERROR, "Invalid PEF section header: section "
"exceeds file: %lu.", sectionEnd);
}
resourceOffset = max(resourceOffset, sectionEnd);
resourceOffset = max_c(resourceOffset, sectionEnd);
}
if (resourceOffset >= fileSize) {
// throw Exception("The PEF object file does not contain resources.");
@ -829,7 +832,7 @@ ResourceFile::_ReadIndexEntry(resource_parse_info &parseInfo, int32 index,
}
// add the entry
if (result) {
ResourceItem *item = new(nothrow) ResourceItem;
ResourceItem *item = new(std::nothrow) ResourceItem;
if (!item)
throw Exception(B_NO_MEMORY);
item->SetLocation(offset, size);
@ -848,7 +851,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
int32 &resourceCount = parseInfo.resource_count;
// read the info table
// alloc memory for the table
char *tableData = new(nothrow) char[parseInfo.info_table_size];
char *tableData = new(std::nothrow) char[parseInfo.info_table_size];
if (!tableData)
throw Exception(B_NO_MEMORY);
int32 dataSize = parseInfo.info_table_size;
@ -856,7 +859,7 @@ ResourceFile::_ReadInfoTable(resource_parse_info &parseInfo)
read_exactly(fFile, parseInfo.info_table_offset, tableData, dataSize,
"Failed to read resource info table.");
//
bool *readIndices = new(nothrow) bool[resourceCount + 1];
bool *readIndices = new(std::nothrow) bool[resourceCount + 1];
// + 1 => always > 0
if (!readIndices)
throw Exception(B_NO_MEMORY);
@ -1040,12 +1043,12 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
indexSectionSize = align_value(indexSectionSize,
kResourceIndexSectionAlignment);
size += indexSectionSize;
bufferSize = max((uint32)bufferSize, indexSectionSize);
bufferSize = max_c((uint32)bufferSize, indexSectionSize);
// unknown section
uint32 unknownSectionOffset = size;
uint32 unknownSectionSize = kUnknownResourceSectionSize;
size += unknownSectionSize;
bufferSize = max((uint32)bufferSize, unknownSectionSize);
bufferSize = max_c((uint32)bufferSize, unknownSectionSize);
// data
uint32 dataOffset = size;
uint32 dataSize = 0;
@ -1054,7 +1057,7 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
if (!item->IsLoaded())
throw Exception(B_IO_ERROR, "Resource is not loaded.");
dataSize += item->DataSize();
bufferSize = max(bufferSize, item->DataSize());
bufferSize = max_c(bufferSize, item->DataSize());
}
size += dataSize;
// info table
@ -1078,12 +1081,12 @@ ResourceFile::_WriteResources(ResourcesContainer &container)
infoTableSize += kResourceInfoSeparatorSize
+ kResourceInfoTableEndSize;
size += infoTableSize;
bufferSize = max((uint32)bufferSize, infoTableSize);
bufferSize = max_c((uint32)bufferSize, infoTableSize);
// write...
// set the file size
fFile.SetSize(size);
buffer = new(nothrow) char[bufferSize];
buffer = new(std::nothrow) char[bufferSize];
if (!buffer)
throw Exception(B_NO_MEMORY);
void *data = buffer;

View File

@ -1,7 +1,12 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//----------------------------------------------------------------------
/*
* Copyright 2002-2006, Haiku Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Tyler Dauwalder
* Ingo Weinhold, bonefish@users.sf.net
*/
/*!
\file storage_support.cpp
Implementations of miscellaneous internal Storage Kit support functions.
@ -18,8 +23,6 @@
#include "storage_support.h"
using namespace std;
namespace BPrivate {
namespace Storage {
@ -333,7 +336,7 @@ parse_first_path_component(const char *path, char *&component,
int32 length;
status_t error = parse_first_path_component(path, length, nextComponent);
if (error == B_OK) {
component = new(nothrow) char[length + 1];
component = new(std::nothrow) char[length + 1];
if (component) {
strncpy(component, path, length);
component[length] = '\0';
@ -477,7 +480,7 @@ void escape_path(const char *str, char *result)
void escape_path(char *str)
{
if (str) {
char *copy = new(nothrow) char[strlen(str)+1];
char *copy = new(std::nothrow) char[strlen(str)+1];
if (copy) {
strcpy(copy, str);
escape_path(copy, str);

View File

View File

@ -2434,7 +2434,7 @@ vm_page_fault(addr_t address, addr_t fault_address, bool is_write, bool is_user,
area ? area->name : "???", fault_address - (area ? area->base : 0x0));
// We can print a stack trace of the userland thread here.
#if 1
#if 0
if (area) {
struct stack_frame {
#ifdef __INTEL__