Skip to content

Commit

Permalink
Preprocessor: check for empty computed included
Browse files Browse the repository at this point in the history
Closes Vexu#588
  • Loading branch information
ehaas authored and Vexu committed Dec 14, 2023
1 parent b269ee9 commit e7437dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/aro/Preprocessor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ fn reconstructIncludeString(pp: *Preprocessor, param_toks: []const Token, embed_
const params = param_toks[begin..end];

if (params.len == 0) {
if (param_toks.len == 0) return null;
try pp.comp.addDiagnostic(.{
.tag = .expected_filename,
.loc = param_toks[0].loc,
Expand Down
5 changes: 5 additions & 0 deletions test/cases/empty computed include.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define FOO
#include FOO

#define EXPECTED_ERRORS "empty computed include.c:2:10: error: expected \"FILENAME\" or <FILENAME>" \

0 comments on commit e7437dc

Please sign in to comment.