-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add declaration to expose enable_* functions from SerialBase #14175
Conversation
UnBufferedSerial is missing a declaration to expose enable_input and enable_output, which are inherited from the private base class Serial Base. Add the using-declaration to the class definition.
@harmut01, thank you for your changes. |
This exposes the member functions for If I was reading the Compiler Explorer output from @ithinuel's example (https://godbolt.org/z/aoE78x) correctly, it looked like the |
@kjbracey-arm I did explore a bit more using armv7-a clang with @pan- Is that a valid solution ? |
I don't see how you conclude that from your example. You don't have an actual I'd suggest actually running a real test rather than inspecting disassembly. |
@harmut01 have you run it on the target or can you? Is there a test case (if not we should add it) ? |
If that's the original code in the issue, it doesn't test the My later code using |
I amended the Godbolt snippet to reflect more closely the problem: https://godbolt.org/z/r5vPe9 . As we can see, if the If a proper override is provided, the function become consistent regardless of the pointer type accessing it. I think this PR should provide proper overrides for functions marked as virtual in |
I believe that only applies to these 2 functions. It does appear then that there's no way to have |
Pull request has been modified.
To be more explicit - this is following the Either you document explicitly that I see no hugely strong reason to lock this in to "can never fail" as part of the API, even if that's true of the current implementation. (Is it even true? Or is it the case that |
I don't know if the introduction of that feature is related to the time I had to hack in the serial HAL that ability to disable individually rx and/or tx. So for what it's worth, I the time only 2 device where of interest to me and that operation couldn't fail. Now, If we consider the likely possibility of convergence of USBCDC/USBSerial and SerialBase through
It may feel like we're diverging from the point here but this is what needs to be considered now if we lock into Remember that compilers are really smart. If it sees that it always return 0, it'll eliminate unnecessary code on it's own. |
Still think that should be deprecated, as per #5655. Guess it still hasn't happened yet. Did kill Anyway, this is implementing the This API is slightly unusual though in that it was not intended to actually be a "mute" - the device wasn't /required/ to actually block all input/output, it was just for power saving purposes. Something a bit like the "deep sleep lock", which is what it originally was just an abstraction for. This isn't actually clear in the current Doxygen though. So actually looking for "success"/"failure" isn't really that useful anyway. It's not an API that does something for you, it's an API that tells the system what you're up to. I can't honestly think of any case an application would want to look at the return code. It's really there just for consistency with other
It could only do that if the definition was in the header or if you had Link-Time Optimisation on. That would be an argument for moving the definition to the header. |
This force push reverts the function header comment. We can leave the API as is for now and if the behavior is ever needed we will at least have the option to implement it. |
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
Fixes #14052
UnBufferedSerial is missing a declaration to expose enable_input and enable_output, which are inherited from the private base class SerialBase. Add the using-declaration to the class definition to expose these functions.
Impact of changes
None
Migration actions required
None
Documentation
None
Pull request type
Test results
Reviewers
@kjbracey-arm @ithinuel @hugueskamba