You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "acassis (via GitHub)" <gi...@apache.org> on 2024/07/06 19:43:43 UTC
[PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
acassis opened a new pull request, #12638:
URL: https://github.com/apache/nuttx/pull/12638
## Summary
Some rules on NuttX cannot be defined on Kconfig, otherwise we could limit some use cases. However in the other hand many errors happen when users select a feature and forgot to enable other. A way to detect these lazy dependencies is using #ifdefs inside the source code. NuttX uses this resource a lot, but in some cases when we have more than one use cases, we need some way to disable this constrain.
## Impact
Allow to create #ifdef rules to check CONFIGs consistency that cannot be enforced on Kconfig and allow advanced users that want to use features in specific ways ignore that enforced checked rules
## Testing
SIM
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12638:
URL: https://github.com/apache/nuttx/pull/12638#discussion_r1667592912
##########
Documentation/introduction/rules_check.rst:
##########
@@ -0,0 +1,54 @@
+============
+Rules Checks
+============
+
+.. note:: this should be revised
+
+NuttX uses Kconfig and its main checking for rules and dependencies between
+features to guarantee that the system will compile correctly.
+
+Another resource used to enforce that none pre-required feature was left behind
+is the "#ifdef" inside the source code. Although effective to detect configuration
+issue, this technic should be avoid in favor of more well though rules inside
+Kconfig.
+
+However, it is not possible to enforce many rules inside the Kconfig, otherwise
+the configuration becomes very inflexible and will not allow some use cases.
+
+For those case where Kconfig rule cannot fix everything, we need to return to
+#ifdef approach inside the code. But there is an issue: imagine we put a rule
+inside the file_feature_A.c:
+
+.. code-block:: c
+
+ #if !defined(CONFIG_FEATURE_B)
Review Comment:
the correct approach is adding `depend on` or `select` to express the relationship in Kconfig to avoid the error happen directly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis closed pull request #12638: Kconfig: Add option to disable error checking for lazy dependencies
URL: https://github.com/apache/nuttx/pull/12638
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #12638:
URL: https://github.com/apache/nuttx/pull/12638#issuecomment-2212442287
make ranconfig will help us fixing many Kconfig problem before end user hit them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #12638:
URL: https://github.com/apache/nuttx/pull/12638#issuecomment-2212299143
BTW, Linux has the an automatic method to find the Kconfig bug:
https://people.netfilter.org/hawk/presentations/ifdef2016/ifdef_FOSD2016.pdf
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #12638:
URL: https://github.com/apache/nuttx/pull/12638#discussion_r1667671527
##########
Documentation/introduction/rules_check.rst:
##########
@@ -0,0 +1,54 @@
+============
+Rules Checks
+============
+
+.. note:: this should be revised
+
+NuttX uses Kconfig and its main checking for rules and dependencies between
+features to guarantee that the system will compile correctly.
+
+Another resource used to enforce that none pre-required feature was left behind
+is the "#ifdef" inside the source code. Although effective to detect configuration
+issue, this technic should be avoid in favor of more well though rules inside
+Kconfig.
+
+However, it is not possible to enforce many rules inside the Kconfig, otherwise
+the configuration becomes very inflexible and will not allow some use cases.
+
+For those case where Kconfig rule cannot fix everything, we need to return to
+#ifdef approach inside the code. But there is an issue: imagine we put a rule
+inside the file_feature_A.c:
+
+.. code-block:: c
+
+ #if !defined(CONFIG_FEATURE_B)
Review Comment:
Hi Xiang, exactly but the idea it to find and report warning for "probably desire of use". Imagine someone enabled NET and IPv4, it is probable that he/she wants to use ICMP but we cannot enforce it because we don't know what his/her use case. So we could add some checking in the code to print #error or #warn to let the user aware. It is already used in the NuttX in many places
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kconfig: Add option to disable error checking for lazy dependencies [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12638:
URL: https://github.com/apache/nuttx/pull/12638#issuecomment-2212431331
> BTW, Linux has the an automatic method to find the dependence bug in Kconfig: https://people.netfilter.org/hawk/presentations/ifdef2016/ifdef_FOSD2016.pdf
Really nice article @xiaoxiang781216 I'm considering to close this PR, but just keep it open for a while to let to improve our discussion
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org