+2007-11-20 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
+
+ Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
+ -Werror to succeed. At present they will crash when executed due to code that is not safe
+ under strict aliasing (<rdar://problem/5536806>).
+
+ * Configurations/Base.xcconfig: Exclude the -Wno-long-double flag when building with GCC 4.2.
+ * kjs/date_object.cpp:
+ (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
+ * kjs/dtoa.cpp:
+ (Bigint::): Tweak formatting to silence warnings.
+ * pcre/pcre_exec.cpp:
+ (match): Tweak formatting to silence warnings
+ * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
+ * wtf/Assertions.h: Ditto.
+
2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
wx port build fix (wx headers include ctype functions).
PREBINDING = NO;
VALID_ARCHS = i386 ppc x86_64 ppc64;
WARNING_CFLAGS = $(WARNING_CFLAGS_$(CURRENT_ARCH));
-WARNING_CFLAGS_BASE = -Wall -W -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wno-long-double -Wundef;
+WARNING_CFLAGS_BASE = -Wall -W -Wcast-align -Wchar-subscripts -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings -Wno-format-y2k -Wundef;
WARNING_CFLAGS_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
WARNING_CFLAGS_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
WARNING_CFLAGS_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32;
struct tm gtm = t;
strftime(tzname, sizeof(tzname), "%Z", >m);
- if (tzname) {
+ if (tzname[0]) {
snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)",
t.hour, t.minute, t.second,
gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60, tzname);
if (dval(d) > 0.5 + dval(eps))
goto bump_up;
else if (dval(d) < 0.5 - dval(eps)) {
- while(*--s == '0');
+ while (*--s == '0') { }
s++;
goto ret1;
}
#ifdef Honor_FLT_ROUNDS
trimzeros:
#endif
- while(*--s == '0');
+ while (*--s == '0') { }
s++;
}
ret:
if (stack.currentFrame->eptr >= md->end_subject ||
(*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))
RRETURN_NO_MATCH;
- while (++stack.currentFrame->eptr < md->end_subject && ISMIDCHAR(*stack.currentFrame->eptr));
+ while (++stack.currentFrame->eptr < md->end_subject && ISMIDCHAR(*stack.currentFrame->eptr)) { }
}
break;
if (stack.currentFrame->eptr >= md->end_subject ||
(*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))
RRETURN_NO_MATCH;
- while (++stack.currentFrame->eptr < md->end_subject && ISMIDCHAR(*stack.currentFrame->eptr));
+ while (++stack.currentFrame->eptr < md->end_subject && ISMIDCHAR(*stack.currentFrame->eptr)) { }
}
break;
extern "C" {
-// This is to work around the "you should use a printf format attribute" warning on GCC
-// We can't use _attribute__ ((format (printf, 2, 3))) since we allow %@
-static int (* vfprintf_no_warning)(FILE *, const char*, va_list) = vfprintf;
-
+WTF_ATTRIBUTE_PRINTF(1, 0)
static void vprintf_stderr_common(const char* format, va_list args)
{
#if PLATFORM(MAC)
} while (size > 1024);
}
#endif
- vfprintf_no_warning(stderr, format, args);
+ vfprintf(stderr, format, args);
}
+WTF_ATTRIBUTE_PRINTF(1, 2)
static void printf_stderr_common(const char* format, ...)
{
va_list args;
#define WTF_PRETTY_FUNCTION __FUNCTION__
#endif
+// WTF logging functions can process %@ in the format string to log a NSObject* but the printf format attribute
+// emits a warning when %@ is used in the format string. Until <rdar://problem/5195437> is resolved we can't include
+// the attribute when being used from Objective-C code in case it decides to use %@.
+#if COMPILER(GCC) && !defined(__OBJC__)
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments) __attribute__((__format__(printf, formatStringArgument, extraArguments)))
+#else
+#define WTF_ATTRIBUTE_PRINTF(formatStringArgument, extraArguments)
+#endif
+
/* These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled. */
#ifdef __cplusplus
} WTFLogChannel;
void WTFReportAssertionFailure(const char* file, int line, const char* function, const char* assertion);
-void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...);
+void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion);
-void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) ;
-void WTFReportError(const char* file, int line, const char* function, const char* format, ...);
-void WTFLog(WTFLogChannel* channel, const char* format, ...);
-void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...);
+void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+void WTFReportError(const char* file, int line, const char* function, const char* format, ...) WTF_ATTRIBUTE_PRINTF(4, 5);
+void WTFLog(WTFLogChannel* channel, const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3);
+void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
#ifdef __cplusplus
}
+2007-11-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Changes due to <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
+
+ Update format strings to use format specifiers that match the argument types.
+
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::performURLImport):
+ (WebCore::IconDatabase::writeToDatabase):
+ * platform/mac/TextCodecMac.cpp:
+ (WebCore::TextCodecMac::decode):
+ * storage/Database.cpp:
+ (WebCore::Database::deliverAllPendingCallbacks):
+
2007-11-21 Xan Lopez <xan@gnome.org>
Reviewed by Alp Toker.
}
}
- LOG(IconDatabase, "Notifying %i interested page URLs that their icon URL is known due to the import", urlsToNotify.size());
+ LOG(IconDatabase, "Notifying %zu interested page URLs that their icon URL is known due to the import", urlsToNotify.size());
// Now that we don't hold any locks, perform the actual notifications
for (unsigned i = 0; i < urlsToNotify.size(); ++i) {
LOG(IconDatabase, "Notifying icon info known for pageURL %s", urlsToNotify[i].ascii().data());
for (unsigned i = 0; i < iconSnapshots.size(); ++i) {
writeIconSnapshotToSQLDatabase(iconSnapshots[i]);
- LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %li to the DB", urlForLogging(iconSnapshots[i].iconURL).ascii().data(), iconSnapshots[i].timestamp);
+ LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %i to the DB", urlForLogging(iconSnapshots[i].iconURL).ascii().data(), iconSnapshots[i].timestamp);
}
for (unsigned i = 0; i < pageSnapshots.size(); ++i) {
if (status == kTECPartialCharErr && bytesRead == 0) {
// Handle the case where the partial character was not converted.
if (bytesToPutInBuffer >= spaceInBuffer) {
- LOG_ERROR("TECConvertText gave a kTECPartialCharErr but read none of the %u bytes in the buffer", sizeof(m_bufferedBytes));
+ LOG_ERROR("TECConvertText gave a kTECPartialCharErr but read none of the %zu bytes in the buffer", sizeof(m_bufferedBytes));
m_numBufferedBytes = 0;
status = kTECUnmappableElementErr; // should never happen, but use this error code
} else {
break;
}
default:
- LOG_ERROR("text decoding failed with error %d", status);
+ LOG_ERROR("text decoding failed with error %zu", status);
m_error = true;
return String();
}
s_globalCallbackScheduled = false;
}
- LOG(StorageAPI, "Having %u databases deliver their pending callbacks", databases.size());
+ LOG(StorageAPI, "Having %zu databases deliver their pending callbacks", databases.size());
for (unsigned i = 0; i < databases.size(); ++i)
databases[i]->deliverPendingCallback();
}
+2007-11-21 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Changes due to <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
+
+ Update format strings to use format specifiers that match the argument types.
+
+ * Misc/WebGraphicsExtras.c:
+ (WebConvertBGRAToARGB):
+
2007-11-19 Brady Eidson <beidson@apple.com>
Reviewed by Maciej
uint8_t vImagePermuteMap[4] = { 3, 2, 1, 0 }; // Where { 0, 1, 2, 3 } would leave the channels unchanged; this map converts BGRA to ARGB
vImage_Error vImageError = softLink_vImagePermuteChannels_ARGB8888(&vImage, &vImage, vImagePermuteMap, 0);
if (vImageError) {
- LOG_ERROR("Could not convert BGRA image to ARGB: %d", vImageError);
+ LOG_ERROR("Could not convert BGRA image to ARGB: %zd", vImageError);
return FALSE;
}