util: c++-ify usage printing in the m5 utility.
authorGabe Black <gabeblack@google.com>
Sun, 5 Apr 2020 09:27:42 +0000 (02:27 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 24 Jul 2020 03:59:34 +0000 (03:59 +0000)
Change-Id: Ice8641d490fa9a510a6f1e246530ca5c82ef8170
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27555
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
util/m5/src/usage.cc

index 60ceedf2fc382f751022216da75271d3eb0e9d6d..bbcf36af364b68452496d9f6a66ad7594c8a0a81 100644 (file)
@@ -38,9 +38,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <cinttypes>
-#include <cstdio>
 #include <cstdlib>
+#include <iostream>
 
 #include "call_type.hh"
 #include "commands.hh"
@@ -51,16 +50,16 @@ std::string progname;
 void
 usage()
 {
-    fprintf(stderr, "Usage: %s [call type] <command> [arguments]\n",
-            progname.c_str());
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Call types:\n");
-    fprintf(stderr, CallType::usageSummary().c_str());
-    fprintf(stderr, "\n");
-    fprintf(stderr, "Commands:\n");
-    fprintf(stderr, Command::usageSummary().c_str());
-    fprintf(stderr, "\n");
-    fprintf(stderr, "All times in nanoseconds!\n");
+    std::cerr << "Usage: " << progname <<
+        "[call type] <command> [arguments]" << std::endl <<
+        std::endl <<
+        "Call types:" << std::endl <<
+        CallType::usageSummary() <<
+        std::endl <<
+        "Commands:" << std::endl <<
+        Command::usageSummary() <<
+        std::endl <<
+        "All times in nanoseconds!" << std::endl;
 
     exit(1);
 }