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
03ce758d
Commit
03ce758d
authored
4 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] avoid inserting newlines in messages with long command lines
parent
5659c6fc
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
+19
-14
19 additions, 14 deletions
src/kernel_services/ast_queries/file.ml
with
19 additions
and
14 deletions
src/kernel_services/ast_queries/file.ml
+
19
−
14
View file @
03ce758d
...
...
@@ -433,6 +433,15 @@ let replace_in_cpp_cmd cmdl supp_args in_file out_file =
with
Not_found
->
Format
.
sprintf
"%s %s %s -o %s"
cmdl
supp_args
in_file
out_file
(* Note: using Pretty_utils.pp_list without forcing '~pre' and '~suf' to
be empty strings can lead to issues when the commands are too long and
Format's pretty-printer decides to insert newlines.
This concatenation function serves as a reminder to avoid using them.
*)
let
concat_strs
?
(
pre
=
""
)
?
(
sep
=
" "
)
l
=
if
l
=
[]
then
""
else
pre
^
(
String
.
concat
sep
l
)
let
build_cpp_cmd
=
function
|
NoCPP
_
|
External
_
->
None
|
NeedCPP
(
f
,
cmdl
,
is_gnu_like
)
->
...
...
@@ -490,15 +499,13 @@ let build_cpp_cmd = function
if
is_gnu_like
=
Unknown
&&
not
(
Kernel
.
CppCommand
.
is_set
()
)
&&
unsupported_cpp_arch_args
<>
[]
then
Kernel
.
warning
~
once
:
true
"your preprocessor is not known to handle option(s) `%
a
', \
"your preprocessor is not known to handle option(s) `%
s
', \
considered necessary for machdep `%s'. To ensure compatibility \
between your preprocessor and the machdep, consider using \
-cpp-command with the appropriate flags. \
Your preprocessor is known to support these flags: %a"
(
Pretty_utils
.
pp_list
~
sep
:
" "
Format
.
pp_print_string
)
unsupported_cpp_arch_args
(
Kernel
.
Machdep
.
get
()
)
(
Pretty_utils
.
pp_list
~
sep
:
" "
Format
.
pp_print_string
)
Fc_config
.
preprocessor_supported_arch_options
;
Your preprocessor is known to support these flags: %s"
(
concat_strs
unsupported_cpp_arch_args
)
(
Kernel
.
Machdep
.
get
()
)
(
concat_strs
Fc_config
.
preprocessor_supported_arch_options
);
let
extra_args
=
if
Kernel
.
ReadAnnot
.
get
()
then
if
Kernel
.
PreprocessAnnot
.
is_set
()
then
...
...
@@ -510,12 +517,11 @@ let build_cpp_cmd = function
opt
@
extra_args
else
extra_args
in
let
pp_str
=
Format
.
pp_print_string
in
let
string_of_supp_args
extra
includes
defines
=
Format
.
asprintf
"%
a%a%a
"
(
Pretty_utils
.
pp_list
~
pre
:
" -I"
~
sep
:
" -I"
~
empty
:
""
pp_str
)
includes
(
Pretty_utils
.
pp_list
~
pre
:
" -D"
~
sep
:
" -D"
~
empty
:
""
pp_str
)
defines
(
Pretty_utils
.
pp_list
~
pre
:
" "
~
sep
:
" "
~
empty
:
""
pp_str
)
extra
Format
.
asprintf
"%
s%s%s
"
(
concat_strs
~
pre
:
" -I"
~
sep
:
" -I"
includes
)
(
concat_strs
~
pre
:
" -D"
~
sep
:
" -D"
defines
)
(
concat_strs
~
pre
:
" "
~
sep
:
" "
extra
)
in
let
supp_args
=
string_of_supp_args
...
...
@@ -582,9 +588,8 @@ let parse_cabs cpp_command_no_output = function
preprocessor."
;
true
))
then
begin
let
pp_annot_supp_args
=
Format
.
asprintf
"-nostdinc %a"
(
Pretty_utils
.
pp_list
~
sep
:
" "
Format
.
pp_print_string
)
supported_cpp_arch_args
Format
.
asprintf
"-nostdinc %s"
(
concat_strs
supported_cpp_arch_args
)
in
let
ppf'
=
try
Logic_preprocess
.
file
".c"
...
...
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