* Resolve further warnings on GCC4.
* Enable -Werror on GCC4 builds as well (limited to the same selected targets). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29118 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1033,15 +1033,12 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
: $(scope) ;
|
||||
}
|
||||
} else {
|
||||
# TODO: Enable after updating to a newer gcc 4 version that supports -Wno-error!
|
||||
# -Wuninitialized gives too many false positives.
|
||||
# rule EnableWerror dirTokens : scope {
|
||||
# AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens)
|
||||
# : -Werror -Wno-error=uninitialized : $(scope) ;
|
||||
# AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens)
|
||||
# : -Werror -Wno-error=uninitialized : $(scope) ;
|
||||
# }
|
||||
rule EnableWerror dirTokens : scope {
|
||||
AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens)
|
||||
: -Werror -Wno-error=uninitialized : $(scope) ;
|
||||
AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens)
|
||||
: -Werror -Wno-error=uninitialized : $(scope) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ struct _oproperty_info_;
|
||||
struct compound_type {
|
||||
struct field_pair {
|
||||
#if __GNUC__ > 2
|
||||
const
|
||||
const
|
||||
#endif
|
||||
char *name; // name of entry in message
|
||||
type_code type; // type_code of entry in message
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef enum TokenType {
|
||||
CharacterString,
|
||||
Integer,
|
||||
FloatingPoint
|
||||
};
|
||||
} TokenType;
|
||||
|
||||
/*! \brief Returns a NULL-terminated string contating the
|
||||
name of the given token type
|
||||
|
||||
@@ -1498,7 +1498,7 @@ BApplication::_WindowAt(uint32 index, bool includeMenus) const
|
||||
uint32 count = gLooperList.CountLoopers();
|
||||
for (uint32 i = 0; i < count && index < count; i++) {
|
||||
BWindow* window = dynamic_cast<BWindow*>(gLooperList.LooperAt(i));
|
||||
if (window == NULL || window != NULL && window->fOffscreen
|
||||
if (window == NULL || (window != NULL && window->fOffscreen)
|
||||
|| (!includeMenus && dynamic_cast<BMenuWindow *>(window) != NULL)) {
|
||||
index++;
|
||||
continue;
|
||||
|
||||
@@ -572,11 +572,11 @@ operator<(const BMessenger &_a, const BMessenger &_b)
|
||||
// 3. fPreferredTarget
|
||||
// fTeam is insignificant
|
||||
return (a.Port() < b.Port()
|
||||
|| a.Port() == b.Port()
|
||||
|| (a.Port() == b.Port()
|
||||
&& (a.Token() < b.Token()
|
||||
|| a.Token() == b.Token()
|
||||
|| (a.Token() == b.Token()
|
||||
&& !a.IsPreferredTarget()
|
||||
&& b.IsPreferredTarget()));
|
||||
&& b.IsPreferredTarget()))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -501,15 +501,15 @@ BPropertyInfo::FreeMem()
|
||||
|
||||
if (fPropInfo != NULL) {
|
||||
for (i = 0; i < fPropCount; i++) {
|
||||
free(fPropInfo[i].name);
|
||||
free(fPropInfo[i].usage);
|
||||
free((char *)fPropInfo[i].name);
|
||||
free((char *)fPropInfo[i].usage);
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (k = 0; k < 5; k++) {
|
||||
if (fPropInfo[i].ctypes[j].pairs[k].name == NULL)
|
||||
break;
|
||||
|
||||
free(fPropInfo[i].ctypes[j].pairs[k].name);
|
||||
free((char *)fPropInfo[i].ctypes[j].pairs[k].name);
|
||||
}
|
||||
|
||||
if (fPropInfo[i].ctypes[j].pairs[0].name == NULL)
|
||||
@@ -523,8 +523,8 @@ BPropertyInfo::FreeMem()
|
||||
|
||||
if (fValueInfo != NULL) {
|
||||
for (i = 0; i < fValueCount; i++) {
|
||||
free(fValueInfo[i].name);
|
||||
free(fValueInfo[i].usage);
|
||||
free((char *)fValueInfo[i].name);
|
||||
free((char *)fValueInfo[i].usage);
|
||||
}
|
||||
free(fValueInfo);
|
||||
fValueInfo = NULL;
|
||||
|
||||
@@ -250,7 +250,7 @@ inline
|
||||
uint8
|
||||
PaletteConverter::IndexForRGB16(uint16 rgb) const
|
||||
{
|
||||
return fColorMap->index_map[(rgb >> 1) & 0x7fe0 | rgb & 0x1f];
|
||||
return fColorMap->index_map[((rgb >> 1) & 0x7fe0) | (rgb & 0x1f)];
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +487,7 @@ ReadRGB24(const uint8 **source, int32 index)
|
||||
void
|
||||
WriteGray8(uint8 **dest, uint8 *data, int32 index)
|
||||
{
|
||||
**dest = data[2] * 308 + data[1] * 600 + data[0] * 116 >> 10;
|
||||
**dest = (data[2] * 308 + data[1] * 600 + data[0] * 116) >> 10;
|
||||
// this would boost the speed but is less accurate:
|
||||
//*dest = (data[2] << 8) + (data[1] << 9) + (data[0] << 8) >> 10;
|
||||
(*dest)++;
|
||||
@@ -584,9 +584,9 @@ ConvertBits(const srcByte *srcBits, dstByte *dstBits, int32 srcBitsLength,
|
||||
}
|
||||
|
||||
srcBits = (srcByte*)((uint8*)srcBits + (srcOffsetY * srcBitsPerRow + srcOffsetX
|
||||
* srcBitsPerPixel >> 3));
|
||||
* (srcBitsPerPixel >> 3)));
|
||||
dstBits = (dstByte*)((uint8*)dstBits + (dstOffsetY * dstBitsPerRow + dstOffsetX
|
||||
* dstBitsPerPixel >> 3));
|
||||
* (dstBitsPerPixel >> 3)));
|
||||
|
||||
// Ensure that the width fits
|
||||
int32 srcWidth = (srcBitsPerRow - srcOffsetX * srcBitsPerPixel)
|
||||
|
||||
@@ -1527,7 +1527,7 @@ BListView::_DeselectAll(int32 exceptFrom, int32 exceptTo)
|
||||
bool
|
||||
BListView::_TryInitiateDrag(BPoint where)
|
||||
{
|
||||
if (!fTrack->try_drag | fTrack->item_index < 0)
|
||||
if (!fTrack->try_drag || fTrack->item_index < 0)
|
||||
return false;
|
||||
|
||||
BPoint offset = where - fTrack->drag_start;
|
||||
|
||||
@@ -2626,8 +2626,8 @@ BMenu::_OkToProceed(BMenuItem* item)
|
||||
// TODO: I added the check for BMenuBar to solve a problem with Deskbar.
|
||||
// BeOS seems to do something similar. This could also be a bug in Deskbar, though.
|
||||
if ((buttons != 0 && stickyMode)
|
||||
|| (dynamic_cast<BMenuBar *>(this) == NULL
|
||||
&& (buttons == 0 && !stickyMode) || _HitTestItems(where) != item))
|
||||
|| ((dynamic_cast<BMenuBar *>(this) == NULL
|
||||
&& (buttons == 0 && !stickyMode)) || _HitTestItems(where) != item))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -755,7 +755,7 @@ BMenuItem::_DrawShortcutSymbol()
|
||||
where.x -= fBounds.Height() - 3;
|
||||
|
||||
const float ascent = MenuPrivate(fSuper).Ascent();
|
||||
if (fShortcutChar < B_SPACE && kUTF8ControlMap[fShortcutChar])
|
||||
if (fShortcutChar < B_SPACE && kUTF8ControlMap[(int)fShortcutChar])
|
||||
_DrawControlChar(fShortcutChar, where + BPoint(0, ascent));
|
||||
else
|
||||
fSuper->DrawChar(fShortcutChar, where + BPoint(0, ascent));
|
||||
@@ -849,8 +849,8 @@ BMenuItem::_DrawControlChar(char shortcut, BPoint where)
|
||||
// TODO: If needed, take another font for the control characters
|
||||
// (or have font overlays in the app_server!)
|
||||
const char* symbol = " ";
|
||||
if (kUTF8ControlMap[fShortcutChar])
|
||||
symbol = kUTF8ControlMap[fShortcutChar];
|
||||
if (kUTF8ControlMap[(int)fShortcutChar])
|
||||
symbol = kUTF8ControlMap[(int)fShortcutChar];
|
||||
|
||||
fSuper->DrawString(symbol, where);
|
||||
}
|
||||
|
||||
@@ -874,10 +874,12 @@ BSlider::DrawBar()
|
||||
barColor.red = (fBarColor.red + no_tint.red) / 2;
|
||||
barColor.green = (fBarColor.green + no_tint.green) / 2;
|
||||
barColor.blue = (fBarColor.blue + no_tint.blue) / 2;
|
||||
barColor.alpha = 255;
|
||||
|
||||
fillColor.red = (fFillColor.red + no_tint.red) / 2;
|
||||
fillColor.green = (fFillColor.green + no_tint.green) / 2;
|
||||
fillColor.blue = (fFillColor.blue + no_tint.blue) / 2;
|
||||
fillColor.alpha = 255;
|
||||
}
|
||||
|
||||
// exclude the block thumb from the bar filling
|
||||
@@ -1172,8 +1174,8 @@ BSlider::UpdateTextChanged()
|
||||
|
||||
const char* oldUpdateText = fUpdateText;
|
||||
fUpdateText = UpdateText();
|
||||
bool updateTextOnOff = fUpdateText == NULL && oldUpdateText != NULL
|
||||
|| fUpdateText != NULL && oldUpdateText == NULL;
|
||||
bool updateTextOnOff = (fUpdateText == NULL && oldUpdateText != NULL)
|
||||
|| (fUpdateText != NULL && oldUpdateText == NULL);
|
||||
|
||||
float newWidth = 0.0;
|
||||
if (fUpdateText != NULL)
|
||||
|
||||
@@ -563,8 +563,8 @@ BSplitLayout::StartDraggingSplitter(BPoint point)
|
||||
|
||||
// Things shouldn't be draggable, if we have a >= max layout.
|
||||
BSize size = _SubtractInsets(View()->Frame().Size());
|
||||
if (fOrientation == B_HORIZONTAL && size.width >= fMax.width
|
||||
|| fOrientation == B_VERTICAL && size.height >= fMax.height) {
|
||||
if ((fOrientation == B_HORIZONTAL && size.width >= fMax.width)
|
||||
|| (fOrientation == B_VERTICAL && size.height >= fMax.height)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1133,8 +1133,8 @@ void
|
||||
BSplitLayout::_InternalGetHeightForWidth(float width, bool realLayout,
|
||||
float* minHeight, float* maxHeight, float* preferredHeight)
|
||||
{
|
||||
if (realLayout && fHeightForWidthVerticalLayouterWidth != width
|
||||
|| !realLayout && fCachedHeightForWidthWidth != width) {
|
||||
if ((realLayout && fHeightForWidthVerticalLayouterWidth != width)
|
||||
|| (!realLayout && fCachedHeightForWidthWidth != width)) {
|
||||
// The general strategy is to clone the vertical layouter, which only
|
||||
// knows the general min/max constraints, do a horizontal layout for the
|
||||
// given width, and add the children's height for width constraints to
|
||||
|
||||
@@ -1595,7 +1595,7 @@ void
|
||||
BWindow::SetPulseRate(bigtime_t rate)
|
||||
{
|
||||
// TODO: What about locking?!?
|
||||
if (rate < 0 || (rate == fPulseRate && !(rate == 0 ^ fPulseRunner == NULL)))
|
||||
if (rate < 0 || (rate == fPulseRate && !((rate == 0) ^ (fPulseRunner == NULL))))
|
||||
return;
|
||||
|
||||
fPulseRate = rate;
|
||||
|
||||
@@ -172,7 +172,7 @@ TextGapBuffer::SizeGapTo(long inCount)
|
||||
const char *
|
||||
TextGapBuffer::GetString(int32 fromOffset, int32 *_numBytes)
|
||||
{
|
||||
char *result = "";
|
||||
char *result = (char *)"";
|
||||
if (_numBytes == NULL)
|
||||
return result;
|
||||
|
||||
|
||||
@@ -135,8 +135,8 @@ entry_ref::operator==(const entry_ref &ref) const
|
||||
return (device == ref.device
|
||||
&& directory == ref.directory
|
||||
&& (name == ref.name
|
||||
|| name != NULL && ref.name != NULL
|
||||
&& strcmp(name, ref.name) == 0));
|
||||
|| (name != NULL && ref.name != NULL
|
||||
&& strcmp(name, ref.name) == 0)));
|
||||
}
|
||||
|
||||
/*! \brief Compares the entry_ref with another entry_ref, returning true if they are not equal.
|
||||
@@ -1095,11 +1095,7 @@ operator<(const entry_ref & a, const entry_ref & b)
|
||||
|| (a.device == b.device
|
||||
&& (a.directory < b.directory
|
||||
|| (a.directory == b.directory
|
||||
&& (a.name == NULL && b.name != NULL
|
||||
&& ((a.name == NULL && b.name != NULL)
|
||||
|| (a.name != NULL && b.name != NULL
|
||||
&& strcmp(a.name, b.name) < 0))))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -390,8 +390,8 @@ BPath::operator==(const BPath &item) const
|
||||
bool
|
||||
BPath::operator==(const char *path) const
|
||||
{
|
||||
return (InitCheck() != B_OK && path == NULL
|
||||
|| fName && path && strcmp(fName, path) == 0);
|
||||
return ((InitCheck() != B_OK && path == NULL)
|
||||
|| (fName != NULL && path != NULL && strcmp(fName, path) == 0));
|
||||
}
|
||||
|
||||
//! Performs a simple (string-wise) comparison of paths.
|
||||
|
||||
@@ -359,8 +359,8 @@ PathHandler::_EntryCreated(BMessage* message)
|
||||
}
|
||||
|
||||
// a new directory to watch for us
|
||||
if (!entryContained && !_CloserToPath(entry)
|
||||
|| parentContained && !_WatchRecursively()
|
||||
if ((!entryContained && !_CloserToPath(entry))
|
||||
|| (parentContained && !_WatchRecursively())
|
||||
|| _AddDirectory(entry, true) != B_OK
|
||||
|| _WatchFilesOnly())
|
||||
notify = parentContained;
|
||||
@@ -446,7 +446,7 @@ PathHandler::_EntryMoved(BMessage* message)
|
||||
&& (entryContained || _CloserToPath(entry))) {
|
||||
// there is a new directory to watch for us
|
||||
if (entryContained
|
||||
|| parentContained && !_WatchRecursively()) {
|
||||
|| (parentContained && !_WatchRecursively())) {
|
||||
_AddDirectory(entry, true);
|
||||
// NOTE: entry is toast now!
|
||||
} else if (_GetClosest(fPath.Path(), false,
|
||||
|
||||
@@ -288,10 +288,10 @@ BResources::SetToImage(const void *codeOrDataPointer, bool clobber)
|
||||
int32 cookie = 0;
|
||||
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
if ((addr_t)info.text <= address
|
||||
&& address - (addr_t)info.text < (addr_t)info.text_size
|
||||
|| (addr_t)info.data <= address
|
||||
&& address - (addr_t)info.data < (addr_t)info.data_size) {
|
||||
if (((addr_t)info.text <= address
|
||||
&& address - (addr_t)info.text < (addr_t)info.text_size)
|
||||
|| ((addr_t)info.data <= address
|
||||
&& address - (addr_t)info.data < (addr_t)info.data_size)) {
|
||||
return SetTo(info.name, clobber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +143,9 @@ ResourcesContainer::IndexOf(type_code type, const char *name) const
|
||||
for (int32 i = 0; index == -1 && i < count; i++) {
|
||||
ResourceItem *item = ResourceAt(i);
|
||||
const char *itemName = item->Name();
|
||||
if (item->Type() == type && (name == NULL && itemName == NULL
|
||||
|| name != NULL && itemName != NULL
|
||||
&& !strcmp(name, itemName))) {
|
||||
if (item->Type() == type && ((name == NULL && itemName == NULL)
|
||||
|| (name != NULL && itemName != NULL
|
||||
&& strcmp(name, itemName) == 0))) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ BVolume::KnowsQuery(void) const
|
||||
bool
|
||||
BVolume::operator==(const BVolume &volume) const
|
||||
{
|
||||
return (InitCheck() != B_OK && volume.InitCheck() != B_OK
|
||||
return ((InitCheck() != B_OK && volume.InitCheck() != B_OK)
|
||||
|| fDevice == volume.fDevice);
|
||||
}
|
||||
|
||||
|
||||
@@ -1543,7 +1543,7 @@ BPartition::_SupportsOperation(uint32 flag, uint32 whileMountedFlag,
|
||||
bool
|
||||
BPartition::_SupportsChildOperation(const BPartition* child, uint32 flag) const
|
||||
{
|
||||
if (!fDelegate || child && !child->fDelegate)
|
||||
if (!fDelegate || (child && !child->fDelegate))
|
||||
return false;
|
||||
|
||||
uint32 supported = fDelegate->SupportedChildOperations(
|
||||
|
||||
@@ -260,7 +260,7 @@ TokenStream::SetTo(const std::string &string) {
|
||||
tsssEscapeOneOctal,
|
||||
tsssEscapeTwoOctal,
|
||||
tsssEscapeOneHex,
|
||||
};
|
||||
} TokenStreamScannerState;
|
||||
|
||||
TokenStreamScannerState state = tsssStart;
|
||||
TokenStreamScannerState escapedState = tsssStart;
|
||||
|
||||
Reference in New Issue
Block a user