Hi,

I'm currently working on a project (msysgit) which incorporates
functionality from gnulib (poll).

As I tried to compile poll.c with clang 3.2 I stumbled on a minor problem which I thought you might be interested in the solution.

Thomas

>From 5f7f1bc025b82dff72695235ee6dda5b36d9386c Mon Sep 17 00:00:00 2001
From: Thomas Braun <thomas.br...@virtuell-zuhause.de>
Date: Thu, 2 May 2013 21:09:31 +0200
Subject: [PATCH] Add pragma to ignore clang warning

Compiling poll.c with clang 3.2 and "-Wall -Werror" gives the following
error message:

poll.c:456:11: error: comparison of unsigned expression < 0 is always
false [-Werror,-Wtautological-compare]
  if (nfd < 0 || timeout < -1)
        ~~~ ^ ~
        1 error generated.
        make: *** [compat/poll/poll.o] Error 1

This warning is now explicitly disabled for clang as done
already for gcc.

Signed-off-by: Thomas Braun <thomas.br...@virtuell-zuhause.de>
---
 lib/poll.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/poll.c b/lib/poll.c
index 2cf6829..27c54b7 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -21,6 +21,8 @@
 /* Tell gcc not to warn about the (nfd < 0) tests, below.  */
 #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
 # pragma GCC diagnostic ignored "-Wtype-limits"
+#elif __clang__
+# pragma clang diagnostic ignored "-Wtautological-compare"
 #endif
 
 #include <config.h>
-- 
1.8.1.msysgit.1

Reply via email to