Skip to content

Commit

Permalink
i#2006 generalize drcachesim: fix errors in success checks (#2278)
Browse files Browse the repository at this point in the history
Fixes bugs where the ! operator is used incorrectly when checking for
analyzer and tool instantiation success.

Adds missing simulator types to the usage messages.
  • Loading branch information
derekbruening authored Mar 10, 2017
1 parent a7ff3fa commit 8480b6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions clients/drcachesim/analyzer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2016 Google, Inc. All rights reserved.
* Copyright (c) 2016-2017 Google, Inc. All rights reserved.
* **********************************************************/

/*
Expand Down Expand Up @@ -152,7 +152,7 @@ analyzer_t::create_analysis_tools()
HISTOGRAM ", or " REUSE_DIST ".\n");
return false;
}
if (!tools[0])
if (!*tools[0])
return false;
num_tools = 1;
return true;
Expand Down
5 changes: 3 additions & 2 deletions clients/drcachesim/common/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ droption_t<std::string> op_TLB_replace_policy

droption_t<std::string> op_simulator_type
(DROPTION_SCOPE_FRONTEND, "simulator_type", CPU_CACHE,
"Simulator type", "Specifies the type of the simulator. "
"Supported types: " CPU_CACHE", " TLB".");
"Simulator type (" CPU_CACHE", " TLB", " REUSE_DIST", or " HISTOGRAM").",
"Specifies the type of the simulator. "
"Supported types: " CPU_CACHE", " TLB", " REUSE_DIST", or " HISTOGRAM".");

droption_t<unsigned int> op_verbose
(DROPTION_SCOPE_ALL, "verbose", 0, 0, 64, "Verbosity level",
Expand Down
6 changes: 3 additions & 3 deletions clients/drcachesim/launcher.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2015-2016 Google, Inc. All rights reserved.
* Copyright (c) 2015-2017 Google, Inc. All rights reserved.
* **********************************************************/

/*
Expand Down Expand Up @@ -185,7 +185,7 @@ _tmain(int argc, const TCHAR *targv[])
(const char **) argv,
&parse_err, &app_idx)) {
// We try to support no "--" separating the app
if (argv[app_idx][0] != '-') {
if (argv[app_idx] != NULL && argv[app_idx][0] != '-') {
// Treat as the app name
} else {
FATAL_ERROR("Usage error: %s\nUsage:\n%s", parse_err.c_str(),
Expand Down Expand Up @@ -235,7 +235,7 @@ _tmain(int argc, const TCHAR *targv[])
} else {
// declare the analyzer based on its type
analyzer = new analyzer_t;
if (!analyzer) {
if (!*analyzer) {
FATAL_ERROR("failed to initialize analyzer");
}
}
Expand Down

0 comments on commit 8480b6a

Please sign in to comment.