YuuichiNakamura commented on a change in pull request #1271: URL: https://github.com/apache/incubator-nuttx/pull/1271#discussion_r442870010
########## File path: syscall/Makefile ########## @@ -76,27 +88,43 @@ $(BIN1): $(PROXY_OBJS) $(BIN2): $(STUB_OBJS) $(call ARCHIVE, $@, $(STUB_OBJS)) +$(BIN3): $(WRAP_OBJS) + $(call ARCHIVE, $@, $(WRAP_OBJS)) + +$(SYSCALLIST): .context + .depend: Makefile $(SRCS) - $(Q) $(MKDEP) $(PROXYDEPPATH) $(STUBDEPPATH) \ + $(Q) $(MKDEP) $(PROXYDEPPATH) $(STUBDEPPATH) $(WRAPDEPPATH) \ "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep $(Q) touch $@ depend: .depend .context: syscall.csv $(Q) $(MAKE) -C $(TOPDIR)$(DELIM)tools -f Makefile.host mksyscall +ifeq ($(CONFIG_LIB_SYSCALL),y) $(Q) (cd proxies; $(MKSYSCALL) -p $(CSVFILE);) $(Q) (cd stubs; $(MKSYSCALL) -s $(CSVFILE);) +else +ifeq ($(CONFIG_SCHED_INSTRUMENTATION_SYSCALL),y) + $(Q) (cd wraps; $(MKSYSCALL) -w $(CSVFILE);) + $(Q) $(MKSYSCALL) -l $(CSVFILE) > $(SYSCALLLIST:.txt=.h) + $(Q) $(call PREPROCESS, $(SYSCALLLIST:.txt=.h), $(SYSCALLLIST)) + $(Q) sed -i -n -e '/^[^#]/p' $(SYSCALLLIST) Review comment: cpp ## operator cannot concatenate arbitrary string. I found that the C language standard declares that both arguments of the ## operator and the result of the concatenation must be valid preprocessing tokens. If not, the behavior is undefined in the standard. In fact, if passing the following code into GNU cpp, ``` #define CONCAT_(x, y) x##y #define CONCAT(x, y) CONCAT_(x, y) CONCAT(wrap, xxx) CONCAT(--wrap=, xxx) ``` The former CONCAT works well but the latter gets the error `error: pasting "=" and "xxx" does not give a valid preprocessing token`. In your example, abf77a6 concatenates the correct tokens. 925d010 concatenates `CONCAT(/dev/ram, CONFIG_NSH_FATDEVNO)`, works because `CONFIG_NSH_FATDEVNO` has numeric value and the result like "ram0" is the correct token. (But I think "/dev/ram0" is still incorrect token... Strictly speaking, it seems undefined result in the standard.) Anyway, in our case, because "--wrap=" is not correct token, I think that we cannot take this way unfortunately. ---------------------------------------------------------------- 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: us...@infra.apache.org