Hi,
Thanks for the initiative. I agree with it in principle but have some suggestions.
1. We should allow platform owners to enforce or waive this policy for code that is encapsulated with a platform port. E.g one might choose to implement a plat/XX/common with weak functions and derive platforms ports from it. We should allow that.
2. The strong implementation under plat/common needs to fine grained to allow platforms to use "just enough" instead of it being an "all or nothing" solution. Weak functions under plat/common allow us the flexibility to implement only the differences and still include other functionality form the same files. I'm afraid platform owners will lose this flexibility. This is a huge loss and should be carefully weighed before moving forward.
-Varun
-----Original Message----- From: Sandrine Bailleux via TF-A tf-a@lists.trustedfirmware.org Sent: Thursday, February 9, 2023 2:31 PM To: tf-a tf-a@lists.trustedfirmware.org Subject: [TF-A] Coding guidelines update: Discouraging usage of weak functions
External email: Use caution opening links or attachments
Hi all,
As you may know, the TF-A project historically used to make heavy use of weak functions. The code base has numerous examples of them. However, based on previous discussions, I think we have general consensus in the TF-A community that the disadvantages of weak functions outweigh their benefits and for this reason we should discourage introducing new ones.
In practice, I think this policy is already enforced most of the time in code reviews but I've now posted a patch that makes it explicit in the project's coding guidelines and provide the rationale behind it.
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.tru...
Note that TF-A maintainers would still be responsible for enforcing this policy, as the CI system won't flag that for them, mainly because I think there might be legitimate cases for weak functions in rare instances so we'd get some false positives from such checks.
We (at Arm) have got plans to gradually convert existing weak functions to strongly-defined implementations across the code base but this will take time.
Like I said, I don't expect this change to be too controversial but please raise any concerns you may have in this email thread or on Gerrit.
Best regards, Sandrine -- TF-A mailing list -- tf-a@lists.trustedfirmware.org To unsubscribe send an email to tf-a-leave@lists.trustedfirmware.org