// Handle cuda "-optf" and "--options-file" argument.
if (str_eq(argv[i], "-optf") || str_eq(argv[i], "--options-file")) {
- if (i > argc) {
- cc_log("Expected argument after -optf/--options-file");
+ if (i == argc - 1) {
+ cc_log("Expected argument after %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
goto out;
// Special handling for -x: remember the last specified language before the
// input file and strip all -x options from the arguments.
if (str_eq(argv[i], "-x")) {
- if (i == argc-1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
// We need to work out where the output was meant to go.
if (str_eq(argv[i], "-o")) {
- if (i == argc-1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
bool separate_argument = (strlen(argv[i]) == 3);
if (separate_argument) {
// -MF arg
- if (i >= argc - 1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
char *relpath;
if (strlen(argv[i]) == 3) {
// -MQ arg or -MT arg
- if (i >= argc - 1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
}
if (str_eq(argv[i], "--serialize-diagnostics")) {
- if (i >= argc - 1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
// to get better hit rate. A secondary effect is that paths in the standard
// error output produced by the compiler will be normalized.
if (compopt_takes_path(argv[i])) {
- if (i == argc-1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;
// Options that take an argument.
if (compopt_takes_arg(argv[i])) {
- if (i == argc-1) {
+ if (i == argc - 1) {
cc_log("Missing argument to %s", argv[i]);
stats_update(STATS_ARGS);
result = false;