util: c++-ify usage printing in the m5 utility.

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>
This commit is contained in:
Gabe Black
2020-04-05 02:27:42 -07:00
parent 9d222570b8
commit cafaccc9d1

View 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);
}