Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
a735c806
Commit
a735c806
authored
2 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] refactor cwd and add PWD to preprocessing error message
parent
a3842e11
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_services/ast_queries/file.ml
+13
-10
13 additions, 10 deletions
src/kernel_services/ast_queries/file.ml
with
13 additions
and
10 deletions
src/kernel_services/ast_queries/file.ml
+
13
−
10
View file @
a735c806
...
@@ -447,16 +447,19 @@ let concat_strs ?(pre="") ?(sep=" ") l =
...
@@ -447,16 +447,19 @@ let concat_strs ?(pre="") ?(sep=" ") l =
if
l
=
[]
then
""
if
l
=
[]
then
""
else
pre
^
(
String
.
concat
sep
l
)
else
pre
^
(
String
.
concat
sep
l
)
let
cwd
()
=
(* TODO: we currently use PWD instead of Sys.getcwd () because OCaml has
no function in its stdlib to resolve symbolic links (e.g. realpath)
for a given path. 'getcwd' always resolves them, but if the user
supplies a path with symbolic links, this may cause issues.
Instead of forcing the user to always provide resolved paths, we
currently choose to never resolve them.
We only resort to getcwd() to avoid issues when PWD does not exist. *)
try
Unix
.
getenv
"PWD"
with
Not_found
->
Sys
.
getcwd
()
let
adjust_pwd
fp
cpp_command
=
let
adjust_pwd
fp
cpp_command
=
if
Kernel
.
JsonCompilationDatabase
.
is_set
()
then
if
Kernel
.
JsonCompilationDatabase
.
is_set
()
then
(* TODO: we currently use PWD instead of Sys.getcwd () because OCaml has
let
cwd
=
cwd
()
in
no function in its stdlib to resolve symbolic links (e.g. realpath)
for a given path. 'getcwd' always resolves them, but if the user
supplies a path with symbolic links, this may cause issues.
Instead of forcing the user to always provide resolved paths, we
currently choose to never resolve them.
We only resort to getcwd() to avoid issues when PWD does not exist. *)
let
cwd
=
try
Unix
.
getenv
"PWD"
with
Not_found
->
Sys
.
getcwd
()
in
let
dir
=
let
dir
=
match
Json_compilation_database
.
get_dir
fp
with
match
Json_compilation_database
.
get_dir
fp
with
|
None
->
cwd
|
None
->
cwd
...
@@ -577,10 +580,10 @@ let abort_with_detailed_pp_message f cpp_command =
...
@@ -577,10 +580,10 @@ let abort_with_detailed_pp_message f cpp_command =
else
""
else
""
in
in
Kernel
.
abort
Kernel
.
abort
"failed to run: %s@
\n
\
"failed to run: %s
\n
(PWD: %s)
@
\n
\
%sSee chapter
\"
Preparing the Sources
\"
in the Frama-C user manual \
%sSee chapter
\"
Preparing the Sources
\"
in the Frama-C user manual \
for more details."
for more details."
cpp_command
possible_cause
cpp_command
(
cwd
()
)
possible_cause
let
parse_cabs
cpp_command
=
function
let
parse_cabs
cpp_command
=
function
|
NoCPP
f
->
|
NoCPP
f
->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment