From: Roy Marples Date: Tue, 11 Nov 2014 10:33:28 +0000 (+0000) Subject: If we don't include sys/queue.h directly the clang analyzer complains X-Git-Tag: v6.6.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf2469a1523e0c17c34bdc6758ff0cb3380ad3c6;p=thirdparty%2Fdhcpcd.git If we don't include sys/queue.h directly the clang analyzer complains about using freed memory. That seems to be a workaround for this upstream bug: http://llvm.org/bugs/show_bug.cgi?id=18222 --- diff --git a/configure b/configure index 24c79f5b..fc62a5b6 100755 --- a/configure +++ b/configure @@ -660,12 +660,14 @@ int main(void) { EOF if $XCC _queue.c -o _queue 2>&3; then TAILQ_FOREACH_SAFE=yes + TAILQ_FOREACH=yes else TAILQ_FOREACH_SAFE=no fi echo "$TAILQ_FOREACH_SAFE" rm -f _queue.c _queue fi + if [ -z "$TAILQ_CONCAT" ]; then printf "Testing for TAILQ_CONCAT ..." cat <_queue.c @@ -679,13 +681,43 @@ int main(void) { EOF if $XCC _queue.c -o _queue 2>&3; then TAILQ_CONCAT=yes + TAILQ_FOREACH=yes else TAILQ_CONCAT=no fi echo "$TAILQ_CONCAT" rm -f _queue.c _queue fi + +if [ -z "$TAILQ_FOREACH" ]; then + printf "Testing for TAILQ_FOREACH ... " + cat <_queue.c +#include +int main(void) { +#ifndef TAILQ_FOREACH +#error TAILQ_FOREACH +#endif + return 0; +} +EOF + if $XCC _queue.c -o _queue 2>&3; then + TAILQ_FOREACH=yes + else + TAILQ_FOREACH=no + fi + echo "$TAILQ_FOREACH" + rm -f _queue.c _queue +fi + if [ "$TAILQ_FOREACH_SAFE" = no -o "$TAILQ_CONCAT" = no ]; then + # If we don't include sys/queue.h then clang analyser finds + # too many false positives. + # See http://llvm.org/bugs/show_bug.cgi?id=18222 + # Strictly speaking this isn't needed, but I like it to help + # catch any nasties. + if [ "$TAILQ_FOREACH" = yes ]; then + echo "#include ">>$CONFIG_H + fi echo "#include \"compat/queue.h\"">>$CONFIG_H else echo "#include " >>$CONFIG_H