summaryrefslogtreecommitdiff
path: root/src/debug.cc
diff options
context:
space:
mode:
authorAhmad Alawneh <[email protected]>2023-06-12 17:31:05 -0400
committerGitHub <[email protected]>2023-06-12 17:31:05 -0400
commitb471b3481b2399222ffd9ee0f007628834e68767 (patch)
tree267f112f3608ce7f4caa898250a3eb24a90814b6 /src/debug.cc
parent73db3f79467cb918c6ac11796268e2492c69b101 (diff)
fixing bunch of formatting warnings (#53)
* fixing bunch of formating warrnings * remove unintialized and unused results warnnings * revert the changes , as it doenst fix the warning --------- Co-authored-by: Fangjia Shen <[email protected]>
Diffstat (limited to 'src/debug.cc')
-rw-r--r--src/debug.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/debug.cc b/src/debug.cc
index 29506bd..e23ffd4 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -124,7 +124,7 @@ void gpgpu_sim::gpgpu_debug() {
fflush(stdout);
char line[1024];
- fgets(line, 1024, stdin);
+ char * ptr = fgets(line, 1024, stdin);
char *tok = strtok(line, " \t\n");
if (!strcmp(tok, "dp")) {
@@ -136,7 +136,11 @@ void gpgpu_sim::gpgpu_debug() {
fflush(stdout);
} else if (!strcmp(tok, "q") || !strcmp(tok, "quit")) {
printf("\nreally quit GPGPU-Sim (y/n)?\n");
- fgets(line, 1024, stdin);
+ ptr = fgets(line, 1024, stdin);
+ if(ptr == NULL ){
+ printf("can't read input\n");
+ exit(0);
+ }
tok = strtok(line, " \t\n");
if (!strcmp(tok, "y")) {
exit(0);