Thread (1 message) 1 message, 1 author, 2021-05-19

Re: [PATCH] simple-ipc: correct ifdefs when NO_PTHREADS is defined

From: Junio C Hamano <hidden>
Date: 2021-05-19 22:03:46

Jeff Hostetler [off-list ref] writes:
quoted
quoted
  #ifdef NO_UNIX_SOCKETS
  #error compat/simple-ipc/ipc-unix-socket.c requires Unix sockets
  #endif
  +#ifdef NO_PTHREADS
+#error compat/simple-ipc/ipc-unix-socket.c requires pthreads
+#endif
+
Do we want to duplicate the requirement here and risk them drifting
apart?
 ...
Would it be better to just have something like the following at the
top of the source files and leave the details to the Makefile:


#ifndef SUPPORTS_SIMPLE_IPC
/*
 * This source file should only be included when Simple IPC
 * is supported.  See the top-level Makefile.
 */
#error SUPPORTS_SIMPLE_IPC not defined
#endif
Yeah, that is a much better message, with even less duplication,
than what I sent.

I do not think #ifndef/#error/#endif adds much value, though.  After
all, the Makefile does not even tell us to feed this file to the
compiler when the C preprocessor macro is not defined, so presumably
whoever hits the #error knows s/he is doing something not supported,
and the point of the new message is to help those who we failed by
leaving the rest of the source file unbuildable even when we defined
the C preprocessor macro in the Makefile (like the mistaken
dependency on pthreads that we missed).

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help