Fix use of undefined pointer types in definitions #78
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-microsoft/ftl-sdk!78
Loading…
Reference in a new issue
No description provided.
Delete branch "computerquip/clang-cl-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This coincidentally also adds support for clang-cl. There's two problems being solved here.
The types
timeevalandtimezoneare not defined where they're used in the gettimeofday.h headertimezoneisn't defined by the WinAPI headers anywhere.timeevalis only defined in Winsock2.h.The implementation of
gettimeofday()here doesn't actually use thetimezonestructure so it may be defined as an opaque pointer without definition.timeevalis used however so it must have a definition, so we must include Winsock2.h in the header. Since the definition in the header didn't originally have a type associated with it, it could be interpreted as a different type from that of the one provided by WinSock2.h. clang-cl believes it to be an anonymous structure in the header so it thinks the function type is different between header declaration and implementation.All CLA requirements met.
Whole header because of 1 small structure?!
https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/ns-winsock2-timeval
Also, winsock inclusion may depend on WIN32_LEAN_AND_MEAN usage.
Possible implementation:
just for info, unused structure is also small:
I think, if function is replacement - it should replace everything.
Is there a push to remove Winsock2.h, who understands its meaning?
github.com/mixer/ftl-sdk@d5340c5842There may be missing instructions to write to CMakeLists.txt.
However, care to
timezoneis necessary.It might be better to replace it with
clock_gettime()and alias if possible.We could just make our own function that returns the time specification we want. For instance, obs uses os_gettime_ns which wraps over platform specifics. Here's an example of a similar function in action:
to
I'm not sure the wanted precision of the clock so I guess that could be nanoseconds above and then just convert on the fly to whatever measurement wanted, perhaps make some convenience functions to do so. I'm also not sure how involved that is to change so maybe take the suggestion with a grain of salt.
Wait as I will do 2 points.
1.To check the bad influence when adding Winsock 2.h to the header file.
2.To find the resolution of the time that is really needed.
I am also looking forward to the removal of this dependence on MSVC semantics, and likely standards non-compliant code, but defining a struct in a function declaration is quite the edge case.
Personally, these changes simply make the code compile on clang-cl, so there is little gain in delaying it to resolve the pre-existing bugs.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.