xiaoxiang781216 commented on a change in pull request #5519:
URL: https://github.com/apache/incubator-nuttx/pull/5519#discussion_r810108886



##########
File path: libs/libc/stdio/lib_fputs.c
##########
@@ -93,16 +93,6 @@ int fputs(FAR const IPTR char *s, FAR FILE *stream)
 {
   int nput;
 
-  /* Make sure that a string was provided. */
-
-#ifdef CONFIG_DEBUG_FEATURES /* Most parameter checking is disabled if DEBUG 
is off */
-  if (s == NULL || stream == NULL)
-    {
-      set_errno(EINVAL);
-      return EOF;
-    }
-#endif
-

Review comment:
       
   > Why eliminate the optional check?
   
   Because compiler issue the following warning when -fno-builtin is removed 
from Make.defs:
   ```
       stdio/lib_fputs.c: In function 'fputs':
       Error: stdio/lib_fputs.c:99:9: error: nonnull argument 's' compared to 
NULL [-Werror=nonnull-compare]
          if (s == NULL || stream == NULL)
                ^
       Error: stdio/lib_fputs.c:99:27: error: nonnull argument 'stream' 
compared to NULL [-Werror=nonnull-compare]
          if (s == NULL || stream == NULL)
   ```
   
   > 
   > Removing it makes this version of fputs() inconsistent to the 
CONFIG_ARCH_ROMGETC version of fputs() above.
   
   Remove the check in CONFIG_ARCH_ROMGETC version too.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to