Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] json-c fix, question about -D_REENTRANT
@ 2012-08-25 14:13 Thomas Petazzoni
  2012-08-25 14:13 ` [Buildroot] [PATCH] json-c: fix build when no thread support is available Thomas Petazzoni
  2012-08-26 23:50 ` [Buildroot] json-c fix, question about -D_REENTRANT Arnout Vandecappelle
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2012-08-25 14:13 UTC (permalink / raw)
  To: buildroot

Hello,

The attached patch fixes the build of json-c when thread support is
not available. This library does not require thread support: it was
compatible with -D_REENTRANT in all cases, which is only possible when
thread support is available.

However, I didn't commit this directly, because I am not sure what the
right fix is. My fix is to just get rid of -D_REENTRANT.

However, according to
http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H, all code
used in a multithreaded application should be built with -D_REENTRANT,
even if this code itself is not creating/manipulating threads.

So, technically, removing -D_REENTRANT seems like an incorrect: it
should be kept if the toolchain supports thread.

However, looking quickly at a number of other libraries, I don't see
any of them being careful about this. I know the -pthread gcc options
passes both the -lpthread linker option and the -D_REENTRANT compiler
option, but I don't see -pthread being used in libraries that don't
need thread support, but that may be used in a multithreaded
application.

Am I missing something?

Thanks,

Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-06 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-25 14:13 [Buildroot] json-c fix, question about -D_REENTRANT Thomas Petazzoni
2012-08-25 14:13 ` [Buildroot] [PATCH] json-c: fix build when no thread support is available Thomas Petazzoni
2012-09-06 21:32   ` Peter Korsgaard
2012-08-26 23:50 ` [Buildroot] json-c fix, question about -D_REENTRANT Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox