-
Notifications
You must be signed in to change notification settings - Fork 274
Cleanup duplicate static inline functions at/after linking #1987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dd3d23d
to
128d1ae
Compare
5fe23d7
to
914fcee
Compare
914fcee
to
833f4cd
Compare
regression/ansi-c/linking1/other.c
Outdated
#ifndef TEST2 | ||
#include "foo.h" | ||
#else | ||
inline void foo(int x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment in either the code or the .desc
files what you're expecting here. I might be being thick, but I don't follow what you're expecting to differ, except that the non-static inline foo
would leave an external-linkage version of the function body around for a potential linked object expecting an extern void foo(int)
, which doesn't in fact exist in this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added explanations in the .desc files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, excellent, thankyou!
@@ -1,4 +1,4 @@ | |||
static int foo(int a) | |||
{ | |||
return a+1; | |||
return a + 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sure the functions are actually different so that the static
variant doesn't get ignored after the changes in this PR.
continue; | ||
|
||
std::string new_name = id2string(rename_it->second); | ||
std::string::size_type suffix_pos = new_name.find("$link"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this grungy string decomposition, how about annotating such symbols with a comment ID_C_original_function_identifier
or such?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would seem nice, but I'm struggling to find a good place to put it in a symbolt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been sticking annotations like this on the type myself. We should agree on a policy though, or make a breaking change to add symbolt::attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think that the name and the type are really disjoint, so I'd much rather sort this out via some to-be-added symbolt::attributes
.
src/linking/linking.cpp
Outdated
return false; | ||
return (new_symbol.is_file_local || old_symbol.is_file_local) && | ||
(new_symbol.type.id() != ID_code || | ||
new_symbol.value == exprt("compiled") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factor out this magic tag exprt?
src/goto-programs/goto_program.cpp
Outdated
@@ -634,3 +634,40 @@ void goto_programt::compute_incoming_edges() | |||
} | |||
} | |||
|
|||
bool goto_programt::instructiont::equal(const instructiont &other) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I'd expect equals
, or operator==
src/goto-programs/goto_program.cpp
Outdated
@@ -634,3 +634,40 @@ void goto_programt::compute_incoming_edges() | |||
} | |||
} | |||
|
|||
bool goto_programt::instructiont::equal(const instructiont &other) const | |||
{ | |||
return type == other.type && code == other.code && guard == other.guard && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading ease: suggest break after each &&
src/goto-programs/goto_program.cpp
Outdated
return false; | ||
|
||
long jump_difference1 = 0; | ||
if(!ins.targets.empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should compare other targets I think -- e.g. catch
instructions have several targets.
833f4cd
to
1bf46ee
Compare
@smowton: all comments either addressed or commented on. @peterschrammel If you have any tests exercising |
Looks good, except I'd move the target distance comparison inside |
@smowton I was about to implement your suggestion but then figured I'd disagree when looking on how this would impact the unified diff implementation: consider |
1bf46ee
to
3d199b1
Compare
Hmmmm, okay, I won't argue the point further |
3d199b1
to
d968793
Compare
@tautschnig, we are retesting this version on our benchmarks. |
@tautschnig, the output is identical to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase.
d16a5b3
to
fd9896f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed Diffblue compatibility checks (cbmc commit: fd9896f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86271881
fd9896f
to
623340a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed Diffblue compatibility checks (cbmc commit: 623340a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88760998
623340a
to
9a0de06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 9a0de06).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95548556
9a0de06
to
dcf5904
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: dcf5904).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/103507544
3b94bf0
to
15dbc4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 15dbc4d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/107061824
15dbc4d
to
2244100
Compare
2244100
to
77bc8f1
Compare
Codecov ReportBase: 78.43% // Head: 78.49% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #1987 +/- ##
===========================================
+ Coverage 78.43% 78.49% +0.06%
===========================================
Files 1670 1670
Lines 191671 191691 +20
===========================================
+ Hits 150331 150470 +139
+ Misses 41340 41221 -119
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@tautschnig Any chance of a push to rerun the CI jobs (including the new/missing one)? |
77bc8f1
to
d34b1a9
Compare
d34b1a9
to
5a9e873
Compare
This will avoid some occurrences of function$linkN names that are confusing to users, in particular when specifying loop unwinding limits.
5a9e873
to
1ee95db
Compare
Closing due to age (no further comment on PR content), please reopen with rebase on develop if you intent to continue this work. |
No description provided.