Update declarations for all functions/methods that accept printf-style
stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses. Fix all incorrect uses. Most of these are innocuous,
a few were resulting in crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140185 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangFunction.cpp b/source/Expression/ClangFunction.cpp
index a8e5a5c..21acb5b 100644
--- a/source/Expression/ClangFunction.cpp
+++ b/source/Expression/ClangFunction.cpp
@@ -176,7 +176,7 @@
}
else
{
- errors.Printf("Could not determine type of input value %d.", i);
+ errors.Printf("Could not determine type of input value %lu.", i);
return 1;
}
}
@@ -335,7 +335,7 @@
size_t num_args = arg_values.GetSize();
if (num_args != m_arg_values.GetSize())
{
- errors.Printf ("Wrong number of arguments - was: %d should be: %d", num_args, m_arg_values.GetSize());
+ errors.Printf ("Wrong number of arguments - was: %lu should be: %lu", num_args, m_arg_values.GetSize());
return false;
}
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index 3e3d9d4..742367f 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -319,7 +319,7 @@
if (error_cstr && error_cstr[0])
error_stream.Printf ("error: %s\n", error_cstr);
else
- error_stream.Printf ("error: expression can't be interpreted or run\n", num_errors);
+ error_stream.Printf ("error: expression can't be interpreted or run\n");
return false;
}
}
@@ -550,7 +550,7 @@
if (error_desc)
error_stream.Printf ("Execution was interrupted, reason: %s.", error_desc);
else
- error_stream.Printf ("Execution was interrupted.", error_desc);
+ error_stream.Printf ("Execution was interrupted.");
if (discard_on_error)
error_stream.Printf ("\nThe process has been returned to the state before execution.");
diff --git a/source/Expression/ClangUtilityFunction.cpp b/source/Expression/ClangUtilityFunction.cpp
index d079dc4..0d11c91 100644
--- a/source/Expression/ClangUtilityFunction.cpp
+++ b/source/Expression/ClangUtilityFunction.cpp
@@ -173,7 +173,7 @@
if (error_cstr && error_cstr[0])
error_stream.Printf ("error: %s\n", error_cstr);
else
- error_stream.Printf ("error: expression can't be interpreted or run\n", num_errors);
+ error_stream.Printf ("error: expression can't be interpreted or run\n");
return false;
}
}
diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp
index b5cd852..037fbc1 100644
--- a/source/Expression/DWARFExpression.cpp
+++ b/source/Expression/DWARFExpression.cpp
@@ -310,8 +310,8 @@
case DW_OP_const4s: s->Printf("DW_OP_const4s(0x%8.8x) ", m_data.GetU32(&offset)); break; // 0x0d 1 4-byte constant
case DW_OP_const8u: s->Printf("DW_OP_const8u(0x%16.16llx) ", m_data.GetU64(&offset)); break; // 0x0e 1 8-byte constant
case DW_OP_const8s: s->Printf("DW_OP_const8s(0x%16.16llx) ", m_data.GetU64(&offset)); break; // 0x0f 1 8-byte constant
- case DW_OP_constu: s->Printf("DW_OP_constu(0x%x) ", m_data.GetULEB128(&offset)); break; // 0x10 1 ULEB128 constant
- case DW_OP_consts: s->Printf("DW_OP_consts(0x%x) ", m_data.GetSLEB128(&offset)); break; // 0x11 1 SLEB128 constant
+ case DW_OP_constu: s->Printf("DW_OP_constu(0x%llx) ", m_data.GetULEB128(&offset)); break; // 0x10 1 ULEB128 constant
+ case DW_OP_consts: s->Printf("DW_OP_consts(0x%lld) ", m_data.GetSLEB128(&offset)); break; // 0x11 1 SLEB128 constant
case DW_OP_dup: s->PutCString("DW_OP_dup"); break; // 0x12
case DW_OP_drop: s->PutCString("DW_OP_drop"); break; // 0x13
case DW_OP_over: s->PutCString("DW_OP_over"); break; // 0x14
@@ -330,7 +330,7 @@
case DW_OP_or: s->PutCString("DW_OP_or"); break; // 0x21
case DW_OP_plus: s->PutCString("DW_OP_plus"); break; // 0x22
case DW_OP_plus_uconst: // 0x23 1 ULEB128 addend
- s->Printf("DW_OP_plus_uconst(0x%x) ", m_data.GetULEB128(&offset));
+ s->Printf("DW_OP_plus_uconst(0x%llx) ", m_data.GetULEB128(&offset));
break;
case DW_OP_shl: s->PutCString("DW_OP_shl"); break; // 0x24
@@ -541,7 +541,7 @@
}
break;
case DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed
- s->Printf("DW_OP_piece(0x%x)", m_data.GetULEB128(&offset));
+ s->Printf("DW_OP_piece(0x%llx)", m_data.GetULEB128(&offset));
break;
case DW_OP_deref_size: // 0x94 1 1-byte size of data retrieved
s->Printf("DW_OP_deref_size(0x%2.2x)", m_data.GetU8(&offset));
@@ -568,7 +568,7 @@
// case DW_OP_lo_user: s->PutCString("DW_OP_lo_user"); break; // 0xe0
// case DW_OP_hi_user: s->PutCString("DW_OP_hi_user"); break; // 0xff
case DW_OP_APPLE_extern:
- s->Printf("DW_OP_APPLE_extern(%u)", m_data.GetULEB128(&offset));
+ s->Printf("DW_OP_APPLE_extern(%llu)", m_data.GetULEB128(&offset));
break;
case DW_OP_APPLE_array_ref:
s->PutCString("DW_OP_APPLE_array_ref");
@@ -589,7 +589,7 @@
s->PutCString("DW_OP_APPLE_deref_type");
break;
case DW_OP_APPLE_expr_local: // 0xF5 - ULEB128 expression local index
- s->Printf("DW_OP_APPLE_expr_local(%u)", m_data.GetULEB128(&offset));
+ s->Printf("DW_OP_APPLE_expr_local(%llu)", m_data.GetULEB128(&offset));
break;
case DW_OP_APPLE_constf: // 0xF6 - 1 byte float size, followed by constant float data
{
@@ -1029,7 +1029,7 @@
if (log)
{
size_t count = stack.size();
- log->Printf("Stack before operation has %d values:", count);
+ log->Printf("Stack before operation has %lu values:", count);
for (size_t i=0; i<count; ++i)
{
StreamString new_value;
@@ -2856,7 +2856,7 @@
else if (log)
{
size_t count = stack.size();
- log->Printf("Stack after operation has %d values:", count);
+ log->Printf("Stack after operation has %lu values:", count);
for (size_t i=0; i<count; ++i)
{
StreamString new_value;
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index 4d28c04..6a70d4d 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -1465,7 +1465,7 @@
off_t value_alignment = (ast_context->getTypeAlign(qual_type) + 7) / 8;
if (log)
- log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %d, align %d]",
+ log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %lu, align %lld]",
name.c_str(),
qual_type.getAsString().c_str(),
PrintType(value_type).c_str(),
@@ -1815,7 +1815,7 @@
}
ss.flush();
- log->Printf("Found ConstantFP with size %d and raw data %s", operand_data_size, s.c_str());
+ log->Printf("Found ConstantFP with size %lu and raw data %s", operand_data_size, s.c_str());
}
lldb_private::DataBufferHeap data(operand_data_size, 0);
@@ -2186,7 +2186,7 @@
}
if (log)
- log->Printf(" \"%s\" [\"%s\"] (\"%s\") placed at %d",
+ log->Printf(" \"%s\" [\"%s\"] (\"%s\") placed at %lld",
value->getName().str().c_str(),
name.GetCString(),
PrintValue(value, true).c_str(),
@@ -2225,7 +2225,7 @@
}
if (log)
- log->Printf("Total structure [align %d, size %d]", alignment, size);
+ log->Printf("Total structure [align %lld, size %lu]", alignment, size);
return true;
}