fix print flag mismatch build warning on other platforms

- fix mismatch between %lu and uint64_t in printf flags
Esse commit está contido em:
Sean Cannella
2013-06-27 12:44:16 -07:00
commit de Sara Golemon
commit 9849079ee4
16 arquivos alterados com 38 adições e 28 exclusões
+1 -1
Ver Arquivo
@@ -80,7 +80,7 @@ void BreakStatement::inferTypes(AnalysisResultPtr ar) {
void BreakStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) {
if (m_depth != 1) {
cg_printf("%s %lu;\n", m_name, m_depth);
cg_printf("%s %" PRIu64 ";\n", m_name, m_depth);
} else {
cg_printf("%s;\n", m_name);
}
@@ -980,7 +980,7 @@ bool AdminRequestHandler::handleVMRequest(const std::string &cmd,
int64_t start = Timer::GetCurrentTimeMicros();
if (Transl::Translator::Get()->replace()) {
string msg;
Util::string_printf(msg, "Done %ld ms",
Util::string_printf(msg, "Done %" PRId64 " ms",
(Timer::GetCurrentTimeMicros() - start) / 1000);
transport->sendString(msg);
} else {
+2 -2
Ver Arquivo
@@ -86,7 +86,7 @@ static __thread int64_t epoch;
void dump() {
if (!enabledAny()) return;
auto url = g_context->getRequestUrl(50);
TRACE(0, "STATS %ld %s\n", epoch, url.c_str());
TRACE(0, "STATS %" PRId64 " %s\n", epoch, url.c_str());
#include "hphp/runtime/vm/stats-opcodeDef.h"
#define STAT(s) \
if (!tl_counters[s]) {} else \
@@ -96,7 +96,7 @@ void dump() {
#undef O
for (int i=0; helperNames[i]; i++) {
if (tl_helper_counters[i]) {
TRACE(0, "STAT %-50s %15ld\n",
TRACE(0, "STAT %-50s %15" PRIu64 "\n",
helperNames[i],
tl_helper_counters[i]);
}
+3 -2
Ver Arquivo
@@ -1450,8 +1450,9 @@ private:
*/
void sample_stack() {
char key[512];
snprintf(key, sizeof(key), "%ld.%06ld",
m_last_sample_time.tv_sec, m_last_sample_time.tv_usec);
snprintf(key, sizeof(key), "%" PRId64 ".%06" PRId64,
(int64_t)m_last_sample_time.tv_sec,
(int64_t)m_last_sample_time.tv_usec);
char symbol[5120];
m_stack->getStack(INT_MAX, symbol, sizeof(symbol));
+1 -1
Ver Arquivo
@@ -846,7 +846,7 @@ Variant c_SimpleXMLElement::t___set(Variant name, Variant value) {
} else if (m_is_attribute) {
if (name.isInteger()) {
raise_warning("Cannot change attribute number %" PRId64
" when only %" PRId64 " attributes exist", name.toInt64(),
" when only %zd attributes exist", name.toInt64(),
m_attributes.toArray().size());
} else {
newnode = (xmlNodePtr)xmlNewProp(m_node, (xmlChar *)sname.data(), sv);
+1 -1
Ver Arquivo
@@ -2739,7 +2739,7 @@ void VMExecutionContext::preventReturnsToTC() {
while (ar) {
if (!isReturnHelper(ar->m_savedRip) &&
(tx()->isValidCodeAddress((Transl::TCA)ar->m_savedRip))) {
TRACE_RB(2, "Replace RIP in fp %p, savedRip 0x%lx, "
TRACE_RB(2, "Replace RIP in fp %p, savedRip 0x%" PRIx64 ", "
"func %s\n", ar, ar->m_savedRip,
ar->m_func->fullName()->data());
if (ar->m_func->isGenerator()) {
+5 -3
Ver Arquivo
@@ -644,19 +644,21 @@ void Class::initInstanceBits() {
// Print out stats about what we ended up using
if (Trace::moduleEnabledRelease(Trace::instancebits, 1)) {
Trace::traceRelease("%s: %u classes, %u (%.2f%%) of warmup checks\n",
Trace::traceRelease("%s: %u classes, %" PRIu64 " (%.2f%%) of warmup"
" checks\n",
__FUNCTION__, i-1, accum, 100.0 * accum / total);
if (Trace::moduleEnabledRelease(Trace::instancebits, 2)) {
accum = 0;
i = 1;
for (auto& pair : counts) {
if (i >= 256) {
Trace::traceRelease("skipping the remainder of the %llu classes\n",
Trace::traceRelease("skipping the remainder of the %" PRIu64
" classes\n",
counts.size());
break;
}
accum += pair.second;
Trace::traceRelease("%3u %5.2f%% %7u -- %6.2f%% %7u %s\n",
Trace::traceRelease("%3u %5.2f%% %7u -- %6.2f%% %7" PRIu64 " %s\n",
i++, 100.0 * pair.second / total, pair.second,
100.0 * accum / total, accum,
pair.first->data());
+4 -4
Ver Arquivo
@@ -2896,8 +2896,8 @@ newInstanceHelper(Class* cls, int numArgs, ActRec* ar, ActRec* prevAr) {
ar->setThis(ret);
ar->setVarEnv(nullptr);
arSetSfp(ar, prevAr);
TRACE(2, "newInstanceHelper: AR %p: f %p, savedRbp %#lx, savedRip %#lx"
" this %p\n",
TRACE(2, "newInstanceHelper: AR %p: f %p, savedRbp %#" PRIx64
", savedRip %#" PRIx64 ", this %p\n",
ar, ar->m_func, ar->m_savedRbp, ar->m_savedRip, ar->m_this);
return ret;
}
@@ -3287,7 +3287,7 @@ TranslatorX64::translateWork(const TranslArgs& args) {
srcRec.newTranslation(start);
TRACE(1, "tx64: %zd-byte tracelet\n", a.code.frontier - start);
if (Trace::moduleEnabledRelease(Trace::tcspace, 1)) {
Trace::traceRelease(getUsage().c_str());
Trace::traceRelease("%s", getUsage().c_str());
}
}
@@ -3698,7 +3698,7 @@ TranslatorX64::requestExit() {
Trace::traceRelease("TranslatorX64 perf counters for %s:\n",
g_context->getRequestUrl(50).c_str());
for (int i = 0; i < tpc_num_counters; i++) {
Trace::traceRelease("%-20s %10lld\n",
Trace::traceRelease("%-20s %10" PRId64 "\n",
kPerfCounterNames[i], s_perfCounters[i]);
}
Trace::traceRelease("\n");
+3 -1
Ver Arquivo
@@ -635,7 +635,9 @@ struct SpaceRecorder {
~SpaceRecorder() {
if (Trace::moduleEnabledRelease(Trace::tcspace, 1)) {
ptrdiff_t diff = m_a.code.frontier - m_start;
if (diff) Trace::traceRelease("TCSpace %10s %3d\n", m_name, diff);
if (diff) {
Trace::traceRelease("TCSpace %10s %3" PRId64 "\n", m_name, diff);
}
}
}
};
+1 -1
Ver Arquivo
@@ -3958,7 +3958,7 @@ uint64_t* Translator::getTransCounterAddr() {
uint32_t Translator::addTranslation(const TransRec& transRec) {
if (Trace::moduleEnabledRelease(Trace::trans, 1)) {
// Log the translation's size, creation time, SrcKey, and size
Trace::traceRelease("New translation: %lld %s %u %u %d\n",
Trace::traceRelease("New translation: %" PRId64 " %s %u %u %d\n",
Timer::GetCurrentTimeMicros() - m_createdTime,
folly::format("{}:{}:{}",
curUnit()->filepath()->data(),
+6 -4
Ver Arquivo
@@ -76,14 +76,16 @@ bool Lease::acquire(bool blocking /* = false */ ) {
if (0 == (blocking ?
pthread_mutex_lock(&m_lock) :
pthread_mutex_trylock(&m_lock))) {
TRACE(4, "thr%lx: acquired lease, called by %p,%p\n",
TRACE(4, "thr%" PRIx64 ": acquired lease, called by %p,%p\n",
pthread_self(), __builtin_return_address(0),
__builtin_return_address(1));
if (debug) {
pushRank(RankWriteLease);
if (expire != 0 && m_owner != pthread_self()) {
m_hintGrabbed++;
TRACE(3, "thr%lx acquired hinted lease: expired %" PRId64 "us ago\n",
TRACE(3,
"thr%" PRIx64 ": acquired hinted lease"
", expired %" PRId64 "us ago\n",
pthread_self(), -expireDiff);
} else if (expire != 0 && m_owner == pthread_self()) {
m_hintKept++;
@@ -97,7 +99,7 @@ bool Lease::acquire(bool blocking /* = false */ ) {
return true;
}
if (blocking) {
TRACE(3, "thr%lx: failed to acquired lease in blocking mode\n",
TRACE(3, "thr%" PRIx64 ": failed to acquired lease in blocking mode\n",
pthread_self());
}
return false;
@@ -105,7 +107,7 @@ bool Lease::acquire(bool blocking /* = false */ ) {
void Lease::drop(int64_t hintExpireDelay) {
assert(amOwner());
TRACE(4, "thr%lx: dropping lease, called by %p,%p\n",
TRACE(4, "thr%" PRIx64 ": dropping lease, called by %p,%p\n",
pthread_self(), __builtin_return_address(0),
__builtin_return_address(1));
if (debug) {
+1 -1
Ver Arquivo
@@ -2680,7 +2680,7 @@ Unit* UnitEmitter::create() {
if (RuntimeOption::EvalDumpBytecode) {
// Dump human-readable bytecode.
Trace::traceRelease(u->toString());
Trace::traceRelease("%s", u->toString().c_str());
}
static const bool kVerify = getenv("HHVM_VERIFY");
+1 -1
Ver Arquivo
@@ -578,7 +578,7 @@ struct DataBlock {
}
void qword(const uint64_t qword) {
assert(canEmit(sz::qword));
TRACE(10, "%p q : %016lx\n", frontier, qword);
TRACE(10, "%p q : %016" PRIx64 "\n", frontier, qword);
*(uint64_t*)frontier = qword;
frontier += sz::qword;
}
+3 -2
Ver Arquivo
@@ -42,10 +42,11 @@ void checkRank(Rank r) {
*/
if (prev >= r && r != RankUnranked) {
if (r == RankLeaf) {
fprintf(stderr, "Rank violation in thr%lx! leaf lock from leaf rank; ",
fprintf(stderr,
"Rank violation in thr%" PRIx64 "! leaf lock from leaf rank; ",
pthread_self());
} else {
fprintf(stderr, "Rank violation in thr%lx! lock of rank %d; ",
fprintf(stderr, "Rank violation in thr%" PRIx64 "! lock of rank %d; ",
pthread_self(), r);
}
fprintf(stderr, "held locks:\n");
+1 -1
Ver Arquivo
@@ -175,7 +175,7 @@ void dumpEntry(const RingBufferEntry* e) {
break;
}
default: {
printf("%#x %10u %#lx %d %20s\n",
printf("%#x %10u %#" PRIx64 " %d %20s\n",
e->m_threadId, e->m_seq, e->m_funcId, e->m_offset,
names[e->m_type]);
break;
+4 -2
Ver Arquivo
@@ -165,7 +165,8 @@ std::string prettyNode(const char* name, const P1& p1, const P2& p2) {
string(")");
}
void traceRelease(const char*, ...);
void traceRelease(const char*, ...)
__attribute__((format(printf,1,2)));
void traceRelease(const std::string& s);
// Trace to the global ring buffer in all builds, and also trace normally
@@ -173,7 +174,8 @@ void traceRelease(const std::string& s);
#define TRACE_RB(n, ...) \
HPHP::Trace::traceRingBufferRelease(__VA_ARGS__); \
TRACE(n, __VA_ARGS__);
void traceRingBufferRelease(const char* fmt, ...);
void traceRingBufferRelease(const char* fmt, ...)
__attribute__((format(printf,1,2)));
extern int levels[NumModules];
const char* moduleName(Module mod);