Skip to content

Commit

Permalink
Actually show the "no file path" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Aug 14, 2023
1 parent 168903c commit 4a2c56a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/scan_includes.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,11 @@ void scan_file(const char *filename, bool strict) {
if (is_incbin || is_include) {
// Check that an INCLUDE/INCBIN ends as its own token
char after = is_include ? *(ptr + 7) : *(ptr + 6);
if (after != ' ' && after != '\t' && after != '"') {
if (after != ' ' && after != '\t' && after != '\n' && after != '"') {
break;
}
ptr = strpbrk(ptr, "\"\n");
if (!ptr) {
fprintf(stderr, "%s: no file path after INC%s\n", filename, is_include ? "LUDE" : "BIN");
goto done;
}
else if (*ptr == '"') {
if (*ptr == '"') {
ptr++;
char *include_path = ptr;
size_t length = strcspn(ptr, "\"");
Expand All @@ -95,6 +91,12 @@ void scan_file(const char *filename, bool strict) {
scan_file(include_path, strict);
}
}
else {
fprintf(stderr, "%s: no file path after INC%s\n", filename, is_include ? "LUDE" : "BIN");
if (!ptr) {
goto done;
}
}
}
break;
}
Expand Down

0 comments on commit 4a2c56a

Please sign in to comment.