Fixed compilation issues.

- Removed unused variable argflags.
- Fixed variable name (index_bits -> set_index_bits).
This commit is contained in:
Jacob 2016-04-27 12:07:51 -04:00
parent 0fc77a6828
commit 8d8568fce1
1 changed files with 4 additions and 4 deletions

8
csim.c
View File

@ -27,7 +27,7 @@ int main(int argc, char* argv[])
{ {
size_t set_index_bits = 0, lines = 0, block_bits = 0; // Useful variables. size_t set_index_bits = 0, lines = 0, block_bits = 0; // Useful variables.
char *filename = NULL; char *filename = NULL;
int opt = 0, argflags = 0; int opt = 0;
while ((opt=getopt(argc, argv, "hvs:E:b:t:")) != -1) { while ((opt=getopt(argc, argv, "hvs:E:b:t:")) != -1) {
switch (opt) { switch (opt) {
/* TODO: maybe add checking for optarg swallowing actual arguments. */ /* TODO: maybe add checking for optarg swallowing actual arguments. */
@ -35,7 +35,7 @@ int main(int argc, char* argv[])
VERBOSE = 1; VERBOSE = 1;
break; break;
case 's': // 2^s = number of sets case 's': // 2^s = number of sets
index_bits = parse_int_arg(optarg, 's'); set_index_bits = parse_int_arg(optarg, 's');
break; break;
case 'E': // associativity - lines per set case 'E': // associativity - lines per set
lines = parse_int_arg(optarg, 'E'); lines = parse_int_arg(optarg, 'E');
@ -55,12 +55,12 @@ int main(int argc, char* argv[])
} }
} }
/* If any required arguments were not provided. (argflags != 0b1111) */ /* If any required arguments were not provided. (argflags != 0b1111) */
if (!index_bits || !lines || !block_bits || !filename) { if (!set_index_bits || !lines || !block_bits || !filename) {
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n"); printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n");
return 1; return 1;
} }
/* End of argument parsing. */ /* End of argument parsing. */
printf("Arguments: %zd, %zd, %zd, %hd, %s\n", index_bits, lines, block_bits, VERBOSE, filename); printf("Arguments: %zd, %zd, %zd, %hd, %s\n", set_index_bits, lines, block_bits, VERBOSE, filename);
printSummary(0, 0, 0); printSummary(0, 0, 0);
return 0; return 0;