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
c0a3ed4f
Commit
c0a3ed4f
authored
11 months ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[typing] rename C labels when name clashes with a builtin ACSL label
parent
0a60ac2f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/kernel_internals/typing/rmtmps.ml
+15
-1
15 additions, 1 deletion
src/kernel_internals/typing/rmtmps.ml
tests/syntax/oracle/clabels_builtin_labels.res.oracle
+18
-18
18 additions, 18 deletions
tests/syntax/oracle/clabels_builtin_labels.res.oracle
with
33 additions
and
19 deletions
src/kernel_internals/typing/rmtmps.ml
+
15
−
1
View file @
c0a3ed4f
...
...
@@ -720,6 +720,14 @@ let prefer ~new_label ~old_label =
(* ok, now we give up: anything else is visible in code annotations *)
|
_
->
false
(* if we're forced to keep a C label whose name match a builtin logic label,
we'll rename it to ensure no confusion can arise.
Since the original name is supposed to be unique in the function, and
users are not supposed to use symbols starting with an underscore, the chosen
name ought to be unique.
*)
let
rename_c_label
lab
=
"__fc_user_label_"
^
lab
(* We keep only one label, preferably one that was not introduced by CIL.
* Scan a list of labels and return the data for the label that should be
* kept, and the remaining filtered list of labels *)
...
...
@@ -730,7 +738,13 @@ let labelsToKeep is_removable ll =
let
newlabel
,
keepl
=
match
l
with
|
Case
_
|
Default
_
->
sofar
,
true
|
Label
(
ln
,
_
,
_
)
as
lab
->
begin
|
Label
(
ln
,
loc
,
isuser
)
as
lab
->
let
lab
=
match
Logic_typing
.
builtin_label
ln
with
|
None
->
lab
|
Some
_
->
Label
(
rename_c_label
ln
,
loc
,
isuser
)
in
begin
match
is_removable
lab
,
sofar
with
|
true
,
(
""
,
_
)
->
(* keep this one only if we have no label so far *)
...
...
This diff is collapsed.
Click to expand it.
tests/syntax/oracle/clabels_builtin_labels.res.oracle
+
18
−
18
View file @
c0a3ed4f
...
...
@@ -109,109 +109,109 @@ void named(void)
void post_over_old_1(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_old_2(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_loop_1(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_loop_2(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_other_1(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_other_2(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void post_over_other_3(void)
{
Post: ;
__fc_user_label_
Post: ;
return;
}
void old_over_loop_1(void)
{
Old: ;
__fc_user_label_
Old: ;
return;
}
void old_over_loop_2(void)
{
Old: ;
__fc_user_label_
Old: ;
return;
}
void old_over_other_1(void)
{
Old: ;
__fc_user_label_
Old: ;
return;
}
void old_over_other_2(void)
{
Old: ;
__fc_user_label_
Old: ;
return;
}
void old_over_other_3(void)
{
Old: ;
__fc_user_label_
Old: ;
return;
}
void loop_over_other_1(void)
{
LoopEntry: ;
__fc_user_label_
LoopEntry: ;
return;
}
void loop_over_other_2(void)
{
LoopCurrent: ;
__fc_user_label_
LoopCurrent: ;
return;
}
void loop_over_other_3(void)
{
LoopEntry: ;
__fc_user_label_
LoopEntry: ;
return;
}
void arbitray_other_1(void)
{
Here: ;
__fc_user_label_
Here: ;
return;
}
void arbitray_other_2(void)
{
Init: ;
__fc_user_label_
Init: ;
return;
}
void arbitray_other_3(void)
{
Pre: ;
__fc_user_label_
Pre: ;
return;
}
...
...
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