xiaoxiang781216 commented on code in PR #15579:
URL: https://github.com/apache/nuttx/pull/15579#discussion_r2052007027


##########
tools/mkerrno.py:
##########
@@ -0,0 +1,77 @@
+#!/usr/bin/env python3
+############################################################################
+# tools/mkerrno.py

Review Comment:
   > sorry, can you explain how you can generate an equivalent of C code in 
this PR, eg.
   > 
   > ```c
   > #if defined(EPERM)
   >         case EPERM:
   >             return 1;
   > #endif
   > ```
   > 
   > with the approach?
   > 
   
   it's hard to add `#if defined` in macro definition, but could doable with 
the macro trick like this:
   https://stackoverflow.com/questions/72266480/can-ifdef-be-used-inside-a-macro
   
   > i suppose you mean to have
   > 
   > ```c
   > ERRNO_ITEM(EPERM, 1, "Operation not permitted")
   > ```
   > 
   > but i'm not sure how you can define `ERRNO_ITEM` which expands to an 
equivalent of the above mentioned snippet.
   > 
   > also, the syscall stuff actually has another list: syscall.csv. having 
multiple lists which we need to maintain the consistency is what i want to 
avoid.
   
   syscall.csv define the function prototype, but errno doesn't need it, so the 
header file is enough.
   



-- 
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-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to