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/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 88a130d..2b9643e 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -885,7 +885,7 @@
     {
         // No breakpoint selected; enable all currently set breakpoints.
         target->EnableAllBreakpoints ();
-        result.AppendMessageWithFormat ("All breakpoints enabled. (%d breakpoints)\n", num_breakpoints);
+        result.AppendMessageWithFormat ("All breakpoints enabled. (%lu breakpoints)\n", num_breakpoints);
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
     }
     else
@@ -998,7 +998,7 @@
     {
         // No breakpoint selected; disable all currently set breakpoints.
         target->DisableAllBreakpoints ();
-        result.AppendMessageWithFormat ("All breakpoints disabled. (%d breakpoints)\n", num_breakpoints);
+        result.AppendMessageWithFormat ("All breakpoints disabled. (%lu breakpoints)\n", num_breakpoints);
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
     }
     else
@@ -1301,7 +1301,7 @@
         else
         {
             target->RemoveAllBreakpoints ();
-            result.AppendMessageWithFormat ("All breakpoints removed. (%d breakpoints)\n", num_breakpoints);
+            result.AppendMessageWithFormat ("All breakpoints removed. (%lu breakpoints)\n", num_breakpoints);
         }
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
     }
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp
index 32ac9a2..f6a1846 100644
--- a/source/Commands/CommandObjectMemory.cpp
+++ b/source/Commands/CommandObjectMemory.cpp
@@ -547,7 +547,7 @@
             }
             else if (m_memory_options.m_count.OptionWasSet())
             {
-                result.AppendErrorWithFormat("specify either the end address (0x%llx) or the count (--count %u), not both.\n", end_addr, item_count);
+                result.AppendErrorWithFormat("specify either the end address (0x%llx) or the count (--count %lu), not both.\n", end_addr, item_count);
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
@@ -572,7 +572,7 @@
             }
             
             if (bytes_read < total_byte_size)
-                result.AppendWarningWithFormat("Not all bytes (%u/%u) were able to be read from 0x%llx.\n", bytes_read, total_byte_size, addr);
+                result.AppendWarningWithFormat("Not all bytes (%lu/%lu) were able to be read from 0x%llx.\n", bytes_read, total_byte_size, addr);
         }
 
         StreamFile outfile_stream;
@@ -1012,7 +1012,7 @@
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value 0x%llx is too large to fit in a %u byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value 0x%llx is too large to fit in a %lu byte unsigned integer value.\n", uval64, item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1040,7 +1040,7 @@
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value 0x%llx is too large to fit in a %u byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value 0x%llx is too large to fit in a %lu byte unsigned integer value.\n", uval64, item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1080,7 +1080,7 @@
                 }
                 else if (!SIntValueIsValidForSize (sval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %lli is too large or small to fit in a %u byte signed integer value.\n", sval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %lli is too large or small to fit in a %lu byte signed integer value.\n", sval64, item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1097,7 +1097,7 @@
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %llu is too large to fit in a %u byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %llu is too large to fit in a %lu byte unsigned integer value.\n", uval64, item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
@@ -1114,7 +1114,7 @@
                 }
                 else if (!UIntValueIsValidForSize (uval64, item_byte_size))
                 {
-                    result.AppendErrorWithFormat ("Value %llo is too large to fit in a %u byte unsigned integer value.\n", uval64, item_byte_size);
+                    result.AppendErrorWithFormat ("Value %llo is too large to fit in a %lu byte unsigned integer value.\n", uval64, item_byte_size);
                     result.SetStatus(eReturnStatusFailed);
                     return false;
                 }
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 2f5c1b2..3145984 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -610,7 +610,7 @@
 
         if (command.GetArgumentCount())
         {
-            result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: \n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
+            result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
         }
         else
@@ -733,9 +733,7 @@
                     }
                     else
                     {
-                        result.AppendErrorWithFormat ("No PID specified for attach\n", 
-                                                         attach_pid, 
-                                                         error.AsCString());
+                        result.AppendErrorWithFormat ("No PID specified for attach\n");
                         result.SetStatus (eReturnStatusFailed);
                     
                     }
@@ -1081,15 +1079,14 @@
             }
             else
             {
-                result.AppendErrorWithFormat ("Unable to find process plug-in for remote URL '%s'.\nPlease specify a process plug-in name with the --plugin option, or specify an object file using the \"file\" command: \n", 
-                                              m_cmd_name.c_str(),
-                                              m_cmd_syntax.c_str());
+                result.AppendErrorWithFormat ("Unable to find process plug-in for remote URL '%s'.\nPlease specify a process plug-in name with the --plugin option, or specify an object file using the \"file\" command.\n", 
+                                              m_cmd_name.c_str());
                 result.SetStatus (eReturnStatusFailed);
             }
         }
         else
         {
-            result.AppendErrorWithFormat ("'%s' takes exactly one argument:\nUsage: \n", 
+            result.AppendErrorWithFormat ("'%s' takes exactly one argument:\nUsage: %s\n", 
                                           m_cmd_name.c_str(),
                                           m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
@@ -1317,7 +1314,7 @@
         }
         else
         {
-            result.AppendErrorWithFormat("'%s' takes exactly one signal number argument:\nUsage: \n", m_cmd_name.c_str(),
+            result.AppendErrorWithFormat("'%s' takes exactly one signal number argument:\nUsage: %s\n", m_cmd_name.c_str(),
                                         m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
         }
@@ -1380,7 +1377,7 @@
         }
         else
         {
-            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: \n",
+            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
                                         m_cmd_name.c_str(),
                                         m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
@@ -1438,7 +1435,7 @@
         }
         else
         {
-            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: \n",
+            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
                                         m_cmd_name.c_str(),
                                         m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
diff --git a/source/Commands/CommandObjectSource.cpp b/source/Commands/CommandObjectSource.cpp
index e6b98fa..aba27c1 100644
--- a/source/Commands/CommandObjectSource.cpp
+++ b/source/Commands/CommandObjectSource.cpp
@@ -389,7 +389,7 @@
                         sc_list.GetContextAtIndex (i, scratch_sc);
                         if (scratch_sc.function != NULL)
                         {
-                            s.Printf("\n%d: ", i); 
+                            s.Printf("\n%lu: ", i); 
                             scratch_sc.function->Dump (&s, true);
                         }
                     }
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index 612e162..292b963 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -436,7 +436,7 @@
                 if (thread == NULL)
                 {
                     result.AppendErrorWithFormat ("Thread index %u is out of range (valid values are 0 - %u).\n", 
-                                                  step_thread_idx, 0, num_threads);
+                                                  step_thread_idx, num_threads);
                     result.SetStatus (eReturnStatusFailed);
                     return false;
                 }
@@ -944,7 +944,6 @@
                 const uint32_t num_threads = process->GetThreadList().GetSize();
                 result.AppendErrorWithFormat ("Thread index %u is out of range (valid values are 0 - %u).\n", 
                                               m_options.m_thread_idx, 
-                                              0, 
                                               num_threads);
                 result.SetStatus (eReturnStatusFailed);
                 return false;
@@ -1135,7 +1134,7 @@
         }
         else if (command.GetArgumentCount() != 1)
         {
-            result.AppendErrorWithFormat("'%s' takes exactly one thread index argument:\nUsage: \n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
+            result.AppendErrorWithFormat("'%s' takes exactly one thread index argument:\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
             result.SetStatus (eReturnStatusFailed);
             return false;
         }
diff --git a/source/Commands/CommandObjectType.cpp b/source/Commands/CommandObjectType.cpp
index 6c6b842..45fe0bf 100644
--- a/source/Commands/CommandObjectType.cpp
+++ b/source/Commands/CommandObjectType.cpp
@@ -557,7 +557,7 @@
                                                     &error);
             if (error.Fail())
             {
-                out_stream->Printf (error.AsCString());
+                out_stream->Printf ("%s", error.AsCString());
                 out_stream->Flush();
                 return;
             }
@@ -574,14 +574,14 @@
                                                                   &error);
                 if (error.Fail())
                 {
-                    out_stream->Printf (error.AsCString());
+                    out_stream->Printf ("%s", error.AsCString());
                     out_stream->Flush();
                     return;
                 }
             }
             else
             {
-                out_stream->Printf (error.AsCString());
+                out_stream->Printf ("%s", error.AsCString());
                 out_stream->Flush();
                 return;
             }