-
Notifications
You must be signed in to change notification settings - Fork 401
vcc: New VPI_Probe_Cmp function #4418
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
|
Not sure if there are other good reasons for the VPI function, but since 7a88cab the main motivation should be gone? |
|
Ah, I see it now: The |
|
I wonder if we should catch the tautology/contradiction in vcc: for edit: Or should we just not do this and keep the compiler error, because such a tautology might be a mistake? |
Committer edited: Taken from varnishcache#4418
|
Bugwash:
|
This is just a wrapper around pointers comparison, it avoids C-compiler failures like: error: self-comparison always evaluates to true error: array comparison always evaluates to false Fixes: varnishcache#4410
nigoroll
left a comment
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.
my fetish asks for a static inline, but other than that +1
The compound literal is not supported as a constant expression by older compilers, and trying to avoid it (by defining the probe as a struct literal and then taking a pointer to it) comes with another set of problems around unreferenced symbols. So all in all I must say that the single element array "hack" has many more benefits than were apparent to me and I now changed my mind that they actually are, objectively, the better solution - except for the fact that arrays can not be compared, but that will be fixed with #4418. This reverts commit 7a88cab. Ref #4418 Ref #4410
This is just a wrapper around probes pointers comparison, it avoids C-compiler failures like:
error: self-comparison always evaluates to true
error: array comparison always evaluates to false
Fixes: #4410
And should also fix the failing test case in master branch.