diff --git a/hphp/compiler/code_generator.h b/hphp/compiler/code_generator.h index 138886767..7e14f251f 100644 --- a/hphp/compiler/code_generator.h +++ b/hphp/compiler/code_generator.h @@ -308,7 +308,7 @@ private: public: void print(const char *msg, bool indent = true); private: - void print(const char *fmt, va_list ap); + void print(const char *fmt, va_list ap) ATTRIBUTE_PRINTF(2,0); void printSubstring(const char *start, int length); void printIndent(); std::string getFormattedName(const std::string &file); diff --git a/hphp/runtime/ext/ext_image.cpp b/hphp/runtime/ext/ext_image.cpp index 01678afef..c010c646a 100644 --- a/hphp/runtime/ext/ext_image.cpp +++ b/hphp/runtime/ext/ext_image.cpp @@ -1062,11 +1062,13 @@ static int get_php_tiff_bytes_per_format(int format) { #define TAG_FMT_DOUBLE 12 static int php_vspprintf(char **pbuf, size_t max_len, - const char *format, ...) { + const char *fmt, ...) ATTRIBUTE_PRINTF(3,4); +static int php_vspprintf(char **pbuf, size_t max_len, + const char *fmt, ...) { va_list arglist; char *buf; - va_start(arglist, format); - int len = vspprintf_ap(&buf, max_len, format, arglist); + va_start(arglist, fmt); + int len = vspprintf_ap(&buf, max_len, fmt, arglist); if (buf) { #ifdef IM_MEMORY_CHECK *pbuf = php_strndup_impl(buf, len, __LINE__); @@ -1080,9 +1082,11 @@ static int php_vspprintf(char **pbuf, size_t max_len, } static int php_vspprintf_ap(char **pbuf, size_t max_len, - const char *format, va_list ap) { + const char *fmt, va_list ap) ATTRIBUTE_PRINTF(3,0); +static int php_vspprintf_ap(char **pbuf, size_t max_len, + const char *fmt, va_list ap) { char *buf; - int len = vspprintf_ap(&buf, max_len, format, ap); + int len = vspprintf_ap(&buf, max_len, fmt, ap); if (buf) { #ifdef IM_MEMORY_CHECK *pbuf = php_strndup_impl(buf, len, __LINE__); diff --git a/hphp/runtime/vm/class.cpp b/hphp/runtime/vm/class.cpp index 34ee89c9d..3346c5b5a 100644 --- a/hphp/runtime/vm/class.cpp +++ b/hphp/runtime/vm/class.cpp @@ -652,8 +652,7 @@ void Class::initInstanceBits() { i = 1; for (auto& pair : counts) { if (i >= 256) { - Trace::traceRelease("skipping the remainder of the %" PRIu64 - " classes\n", + Trace::traceRelease("skipping the remainder of the %zu classes\n", counts.size()); break; } diff --git a/hphp/runtime/vm/jit/translator-x64.cpp b/hphp/runtime/vm/jit/translator-x64.cpp index 29c40511b..90a27bae2 100644 --- a/hphp/runtime/vm/jit/translator-x64.cpp +++ b/hphp/runtime/vm/jit/translator-x64.cpp @@ -2307,8 +2307,8 @@ TranslatorX64::enterTC(TCA start, void* data) { start = TCA(0xbee5face); } - TRACE(2, "enterTC: request(%s) args: %" PRIx64 " %" PRIx64 " %" - PRIx64 " %" PRIx64 " %" PRIx64 "\n", + TRACE(2, "enterTC: request(%s) args: %" PRIxPTR " %" PRIxPTR " %" + PRIxPTR " %" PRIxPTR " %" PRIxPTR "\n", reqName(info.requestNum), info.args[0], info.args[1], info.args[2], info.args[3], info.args[4]); @@ -3050,7 +3050,7 @@ TranslatorX64::checkTranslationLimit(SrcKey sk, INC_TPC(max_trans); if (debug && Trace::moduleEnabled(Trace::tx64, 2)) { const vector& tns = srcRec.translations(); - TRACE(1, "Too many (%" PRId64 ") translations: %s, BC offset %d\n", + TRACE(1, "Too many (%zd) translations: %s, BC offset %d\n", tns.size(), curUnit()->filepath()->data(), sk.offset()); SKTRACE(2, sk, "{\n"); @@ -3817,12 +3817,12 @@ std::string TranslatorX64::getUsage() { TargetCache::s_persistent_frontier - TargetCache::s_persistent_start; Util::string_printf( usage, - "tx64: %9zd bytes (%" PRId64 "%%) in ahot.code\n" - "tx64: %9zd bytes (%" PRId64 "%%) in a.code\n" - "tx64: %9zd bytes (%" PRId64 "%%) in astubs.code\n" - "tx64: %9zd bytes (%" PRId64 "%%) in m_globalData\n" - "tx64: %9zd bytes (%" PRId64 "%%) in targetCache\n" - "tx64: %9zd bytes (%" PRId64 "%%) in persistentCache\n", + "tx64: %9zd bytes (%zd%%) in ahot.code\n" + "tx64: %9zd bytes (%zd%%) in a.code\n" + "tx64: %9zd bytes (%zd%%) in astubs.code\n" + "tx64: %9zd bytes (%zd%%) in m_globalData\n" + "tx64: %9zd bytes (%zd%%) in targetCache\n" + "tx64: %9zd bytes (%zd%%) in persistentCache\n", aHotUsage, 100 * aHotUsage / ahot.code.size, aUsage, 100 * aUsage / a.code.size, stubsUsage, 100 * stubsUsage / astubs.code.size, diff --git a/hphp/runtime/vm/jit/translator-x64.h b/hphp/runtime/vm/jit/translator-x64.h index 2688d1504..b90dbe38c 100644 --- a/hphp/runtime/vm/jit/translator-x64.h +++ b/hphp/runtime/vm/jit/translator-x64.h @@ -636,7 +636,7 @@ struct SpaceRecorder { if (Trace::moduleEnabledRelease(Trace::tcspace, 1)) { ptrdiff_t diff = m_a.code.frontier - m_start; if (diff) { - Trace::traceRelease("TCSpace %10s %3" PRId64 "\n", m_name, diff); + Trace::traceRelease("TCSpace %10s %3td\n", m_name, diff); } } } diff --git a/hphp/runtime/vm/unit.cpp b/hphp/runtime/vm/unit.cpp index 8110970d7..5d68cd3f4 100644 --- a/hphp/runtime/vm/unit.cpp +++ b/hphp/runtime/vm/unit.cpp @@ -670,7 +670,7 @@ void Unit::defTypedef(Id id) { } // There might also be a class with this name already. - if (Class* cls = nameList->getCachedClass()) { + if (nameList->getCachedClass()) { raise_error("The name %s is already defined as a class", thisType->name->data()); return; diff --git a/hphp/util/db_query.h b/hphp/util/db_query.h index f03c0b766..4b9ce21bb 100644 --- a/hphp/util/db_query.h +++ b/hphp/util/db_query.h @@ -115,7 +115,7 @@ class DBQuery { * q.filterBy(q.Format("(%s > 0 or %s = 2)", field1, field2)); */ const char *format(const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); - const char *format(const char *fmt, va_list ap); + const char *format(const char *fmt, va_list ap) ATTRIBUTE_PRINTF(2,0); /** * Use "`" to escape all field names in a comma delimited field list. diff --git a/hphp/util/neo/neo_hdf.h b/hphp/util/neo/neo_hdf.h index d866b0a44..c0f6dd045 100644 --- a/hphp/util/neo/neo_hdf.h +++ b/hphp/util/neo/neo_hdf.h @@ -146,7 +146,8 @@ char *hdf_get_value (HDF *hdf, const char *name, const char *defval); * The data set maintains ownership of the string, if you want * a copy you either have to call strdup yourself. */ -char* hdf_get_valuevf (HDF *hdf, const char *namefmt, va_list ap); +char* hdf_get_valuevf (HDF *hdf, const char *namefmt, va_list ap) + ATTRIBUTE_PRINTF(2,0); /* * Function: hdf_get_valuef - Return the value of a node in the data set @@ -359,7 +360,8 @@ NEOERR* hdf_set_value (HDF *hdf, const char *name, const char *value); */ NEOERR* hdf_set_valuef (HDF *hdf, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); -NEOERR* hdf_set_valuevf (HDF *hdf, const char *fmt, va_list ap); +NEOERR* hdf_set_valuevf (HDF *hdf, const char *fmt, va_list ap) + ATTRIBUTE_PRINTF(2,0); /* * Function: hdf_set_int_value - Set the value of a named node to a number diff --git a/hphp/util/neo/neo_misc.h b/hphp/util/neo/neo_misc.h index c5e8d498c..d9b875758 100644 --- a/hphp/util/neo/neo_misc.h +++ b/hphp/util/neo/neo_misc.h @@ -111,7 +111,8 @@ typedef char BOOL; #define FALSE 0 #endif -void ne_vwarn (const char *fmt, va_list ap); +void ne_vwarn (const char *fmt, va_list ap) + ATTRIBUTE_PRINTF(1,0); void ne_warn (const char *fmt, ...) ATTRIBUTE_PRINTF(1,2); void ne_set_log (int level);