[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] test-nl_langinfo: avoid "unsigned expression >= 0 is always
From: |
Bruno Haible |
Subject: |
Re: [PATCH] test-nl_langinfo: avoid "unsigned expression >= 0 is always true" warning |
Date: |
Sun, 17 Oct 2010 22:19:04 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Jim,
> test-nl_langinfo.c:56: warning: comparison of unsigned expression >= 0 \
> is always true [-Wtype-limits]
> Is this change ok with you?
> Alternatively, I'd be slightly happier simply
> to remove the warning-evoking tests.
Commenting out or removing these tests is not OK. These lines test whether
nl_langinfo is returning a reasonable string, that is, not NULL and not a
random pointer.
I prefer to silence the warning explicitly in this case:
2010-10-17 Bruno Haible <address@hidden>
nl_langinfo tests: Silence some warnings.
* tests/test-nl_langinfo.c: Silence -Wtype-limits warnings.
Reported by Jim Meyering.
--- tests/test-nl_langinfo.c.orig Sun Oct 17 22:14:52 2010
+++ tests/test-nl_langinfo.c Sun Oct 17 22:14:39 2010
@@ -1,5 +1,5 @@
/* Test of nl_langinfo replacement.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,13 @@
#include "c-strcase.h"
#include "macros.h"
+/* For GCC >= 4.2, silence the warnings
+ "comparison of unsigned expression >= 0 is always true"
+ in this file. */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
int
main (int argc, char *argv[])
{