You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/02/15 12:30:08 UTC

[GitHub] [incubator-nuttx] Ouss4 opened a new pull request #284: mm/mm_heap: Fix warnings included by #266

Ouss4 opened a new pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284
 
 
   @yamt Please, make sure no other issue was included by this PR.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379830130
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This assertion can't be right.  If line 110 is removed, then fnode has no value.  Similarly for assertion at line 114.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379832833
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   Oh, I just noticed that fnodes is doubly initialized.  That is why you can remove the second initialization.  Sorry, I didn't follow that corrected.
   
   This should still cause a warning about an unused variable and still should be enclosed in conditional logic.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379832729
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   Perhaps including all of lines 108 though 117 in #ifdef CONFIG_DEBUG_ASSERTIONS would eliminate warnings about the unused variable. when CONFIG_DEBUG_ASSERTIONS is not defined.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379830130
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This assertion can't be right.  If line 110 is removed, then fnode has no value.  Similarly for assertion at line 114.  (Nevermind, I was confused).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379832632
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   Then don't you get a warning about fnode being unused?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379830130
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This assertion can't be right.  If line 110 is removed, then fnode has no value.  Similarly for assertion at line 114.
   (Nevermind, I was confused.  Now I see that fnode was doubly initialized).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379830130
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This assertion can't be right.  If line 110 is removed, then fnode has no value.  Similarly for assertion at line 114.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo merged pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo merged pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379832769
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This is the original warning (among 2 others) that this PR fixes.
   When assertions are disabled `fnode` and `prev` were not used.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379832135
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   You mean it won't have a value for DEBUGASSERT?
   But DEBBUGASSERT is only active when assertions are enabled.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-nuttx] patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266

Posted by GitBox <gi...@apache.org>.
patacongo commented on a change in pull request #284: mm/mm_heap: Fix warnings included by #266
URL: https://github.com/apache/incubator-nuttx/pull/284#discussion_r379830130
 
 

 ##########
 File path: mm/mm_heap/mm_mallinfo.c
 ##########
 @@ -105,9 +106,10 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
             }
           else
             {
-              FAR struct mm_freenode_s *fnode;
+#ifdef CONFIG_DEBUG_ASSERTIONS
+              FAR struct mm_freenode_s *fnode = (FAR void *)node;
+#endif
               DEBUGASSERT(node->size >= SIZEOF_MM_FREENODE);
-              fnode = (FAR void *)node;
               DEBUGASSERT(fnode->blink->flink == fnode);
 
 Review comment:
   This assertion can't be right.  If line 110 is removed, then fnode has no value.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services