Skip to content
Snippets Groups Projects
Commit 490df58d authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[lexer] do not change line number if directive refers to non-existing file

parent f1f0f62d
No related branches found
No related tags found
No related merge requests found
......@@ -125,10 +125,11 @@ let setCurrentFile n =
let base_name = current.current_working_directory in
let norm = Filepath.normalize ?base_name n in
if not (is_special_file n) && not (Sys.file_exists norm)
then
then begin
currentLine := None;
Kernel.warning ~wkey:Kernel.wkey_line_directive ~once:true
"ignoring non-existing file '%s', referenced in a line directive" norm
else begin
end else begin
let pos = current.lexbuf.Lexing.lex_curr_p in
current.lexbuf.Lexing.lex_curr_p <- {
pos with Lexing.pos_fname = norm;
......
[kernel] Parsing line_directives.c (with preprocessing)
[kernel:pp:line-directive] Warning:
ignoring non-existing file 'PWD/non-existing-file.c', referenced in a line directive
[kernel:CERT:MSC:37] line_directives.c:1: Warning:
[kernel:CERT:MSC:37] line_directives.c:6: Warning:
Body of function f falls-through. Adding a return statement
[kernel:CERT:MSC:37] line_directives.c:2: Warning:
Body of function g falls-through. Adding a return statement
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment