[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use GCC_LINT, not lint
From: |
Paul Eggert |
Subject: |
[PATCH] Use GCC_LINT, not lint |
Date: |
Mon, 30 May 2016 16:04:37 -0700 |
FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined.
Problem reported by Ken Brown in: http://bugs.gnu.org/23640
* doc/posix-headers/stdnoreturn.texi (stdnoreturn.h):
Document problem with lint and _Noreturn.
* lib/diffseq.h (IF_LINT, IF_LINT2):
* lib/fts.c (sccsid):
* lib/getndelim2.c (IF_LINT):
* lib/gl_anylinked_list2.h (gl_linked_iterator)
(gl_linked_iterator_from_to):
* lib/gl_anytree_list2.h (gl_tree_iterator)
(gl_tree_iterator_from_to):
* lib/gl_anytree_oset.h (gl_tree_iterator):
* lib/gl_array_list.c (gl_array_iterator)
(gl_array_iterator_from_to):
* lib/gl_array_oset.c (gl_array_iterator):
* lib/gl_carray_list.c (gl_carray_iterator)
(gl_carray_iterator_from_to):
* lib/idcache.c:
* lib/inet_ntop.c (IF_LINT):
* lib/regcomp.c (build_charclass_op, create_tree):
* lib/regex_internal.c (re_acquire_state)
(re_acquire_state_context):
* lib/trigl.c (rcsid):
* lib/trim.c (IF_LINT):
* lib/vasnprintf.c (IF_LINT):
* lib/verify.h (assume):
Treat GCC_LINT like lint.
---
ChangeLog | 31 +++++++++++++++++++++++++++++++
doc/posix-headers/stdnoreturn.texi | 5 +++++
lib/diffseq.h | 4 ++--
lib/fts.c | 4 ++--
lib/getndelim2.c | 2 +-
lib/gl_anylinked_list2.h | 4 ++--
lib/gl_anytree_list2.h | 4 ++--
lib/gl_anytree_oset.h | 2 +-
lib/gl_array_list.c | 4 ++--
lib/gl_array_oset.c | 2 +-
lib/gl_carray_list.c | 4 ++--
lib/idcache.c | 2 +-
lib/inet_ntop.c | 2 +-
lib/regcomp.c | 4 ++--
lib/regex_internal.c | 4 ++--
lib/trigl.c | 2 +-
lib/trim.c | 2 +-
lib/vasnprintf.c | 2 +-
lib/verify.h | 2 +-
19 files changed, 61 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8189f4c..8525a80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2016-05-30 Paul Eggert <address@hidden>
+
+ Use GCC_LINT, not lint
+ FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined.
+ Problem reported by Ken Brown in: http://bugs.gnu.org/23640
+ * doc/posix-headers/stdnoreturn.texi (stdnoreturn.h):
+ Document problem with lint and _Noreturn.
+ * lib/diffseq.h (IF_LINT, IF_LINT2):
+ * lib/fts.c (sccsid):
+ * lib/getndelim2.c (IF_LINT):
+ * lib/gl_anylinked_list2.h (gl_linked_iterator)
+ (gl_linked_iterator_from_to):
+ * lib/gl_anytree_list2.h (gl_tree_iterator)
+ (gl_tree_iterator_from_to):
+ * lib/gl_anytree_oset.h (gl_tree_iterator):
+ * lib/gl_array_list.c (gl_array_iterator)
+ (gl_array_iterator_from_to):
+ * lib/gl_array_oset.c (gl_array_iterator):
+ * lib/gl_carray_list.c (gl_carray_iterator)
+ (gl_carray_iterator_from_to):
+ * lib/idcache.c:
+ * lib/inet_ntop.c (IF_LINT):
+ * lib/regcomp.c (build_charclass_op, create_tree):
+ * lib/regex_internal.c (re_acquire_state)
+ (re_acquire_state_context):
+ * lib/trigl.c (rcsid):
+ * lib/trim.c (IF_LINT):
+ * lib/vasnprintf.c (IF_LINT):
+ * lib/verify.h (assume):
+ Treat GCC_LINT like lint.
+
2016-05-29 Bruno Haible <address@hidden>
secure_getenv: Port to many more platforms.
diff --git a/doc/posix-headers/stdnoreturn.texi
b/doc/posix-headers/stdnoreturn.texi
index 19722bd..1bb50b8 100644
--- a/doc/posix-headers/stdnoreturn.texi
+++ b/doc/posix-headers/stdnoreturn.texi
@@ -22,6 +22,11 @@ Portability problems not fixed by Gnulib:
You cannot assume that @code{_Noreturn} is a reserved word;
it might be a macro.
@item
+When the macro @code{lint} is defined, standard headers define
address@hidden (and therefore @code{noreturn}) to be a macro that
+expands to the empty token sequence on some platforms:
+Cygwin 2.5.1, FreeBSD 10.3.
address@hidden
On MSVC 9, @code{noreturn} expands to the empty token sequence, to avoid
problems with standard headers that use @code{__declspec (noreturn)}
directly. Although the resulting code operates correctly, the
diff --git a/lib/diffseq.h b/lib/diffseq.h
index d1a562d..6be7d83 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -76,7 +76,7 @@
/* Use this to suppress gcc's "...may be used before initialized" warnings.
Beware: The Code argument must not contain commas. */
#ifndef IF_LINT
-# ifdef lint
+# if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
# else
# define IF_LINT(Code) /* empty */
@@ -85,7 +85,7 @@
/* As above, but when Code must contain one comma. */
#ifndef IF_LINT2
-# ifdef lint
+# if defined GCC_LINT || defined lint
# define IF_LINT2(Code1, Code2) Code1, Code2
# else
# define IF_LINT2(Code1, Code2) /* empty */
diff --git a/lib/fts.c b/lib/fts.c
index 2c9df2f..bcdcff9 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -46,9 +46,9 @@
#include <config.h>
-#if defined(LIBC_SCCS) && !defined(lint)
+#if defined LIBC_SCCS && !defined GCC_LINT && !defined lint
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
-#endif /* LIBC_SCCS and not lint */
+#endif
#include "fts_.h"
diff --git a/lib/getndelim2.c b/lib/getndelim2.c
index b8bc98f..44424c6 100644
--- a/lib/getndelim2.c
+++ b/lib/getndelim2.c
@@ -52,7 +52,7 @@
#endif
/* Use this to suppress gcc's "...may be used before initialized" warnings. */
-#ifdef lint
+#if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h
index 6250c2b..a1037ed 100644
--- a/lib/gl_anylinked_list2.h
+++ b/lib/gl_anylinked_list2.h
@@ -923,7 +923,7 @@ gl_linked_iterator (gl_list_t list)
result.list = list;
result.p = list->root.next;
result.q = &list->root;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
result.count = 0;
@@ -994,7 +994,7 @@ gl_linked_iterator_from_to (gl_list_t list,
result.q = node;
}
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
result.count = 0;
diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h
index b7ce99d..7e6fe45 100644
--- a/lib/gl_anytree_list2.h
+++ b/lib/gl_anytree_list2.h
@@ -564,7 +564,7 @@ gl_tree_iterator (gl_list_t list)
result.p = node;
/* End point is past the rightmost node. */
result.q = NULL;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
result.count = 0;
@@ -588,7 +588,7 @@ gl_tree_iterator_from_to (gl_list_t list, size_t
start_index, size_t end_index)
result.p = (start_index < count ? node_at (list->root, start_index) : NULL);
/* End point is the node at position end_index. */
result.q = (end_index < count ? node_at (list->root, end_index) : NULL);
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
result.count = 0;
diff --git a/lib/gl_anytree_oset.h b/lib/gl_anytree_oset.h
index 97464cb..127f4e3 100644
--- a/lib/gl_anytree_oset.h
+++ b/lib/gl_anytree_oset.h
@@ -255,7 +255,7 @@ gl_tree_iterator (gl_oset_t set)
result.p = node;
/* End point is past the rightmost node. */
result.q = NULL;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
result.count = 0;
diff --git a/lib/gl_array_list.c b/lib/gl_array_list.c
index 098d8af..66cf34b 100644
--- a/lib/gl_array_list.c
+++ b/lib/gl_array_list.c
@@ -454,7 +454,7 @@ gl_array_iterator (gl_list_t list)
result.count = list->count;
result.p = list->elements + 0;
result.q = list->elements + list->count;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
#endif
@@ -475,7 +475,7 @@ gl_array_iterator_from_to (gl_list_t list, size_t
start_index, size_t end_index)
result.count = list->count;
result.p = list->elements + start_index;
result.q = list->elements + end_index;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
#endif
diff --git a/lib/gl_array_oset.c b/lib/gl_array_oset.c
index 2bc970f..92e69cc 100644
--- a/lib/gl_array_oset.c
+++ b/lib/gl_array_oset.c
@@ -303,7 +303,7 @@ gl_array_iterator (gl_oset_t set)
result.count = set->count;
result.p = set->elements + 0;
result.q = set->elements + set->count;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.i = 0;
result.j = 0;
#endif
diff --git a/lib/gl_carray_list.c b/lib/gl_carray_list.c
index 1e2b453..694b09a 100644
--- a/lib/gl_carray_list.c
+++ b/lib/gl_carray_list.c
@@ -624,7 +624,7 @@ gl_carray_iterator (gl_list_t list)
result.count = list->count;
result.i = 0;
result.j = list->count;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.p = 0;
result.q = 0;
#endif
@@ -645,7 +645,7 @@ gl_carray_iterator_from_to (gl_list_t list, size_t
start_index, size_t end_index
result.count = list->count;
result.i = start_index;
result.j = end_index;
-#ifdef lint
+#if defined GCC_LINT || defined lint
result.p = 0;
result.q = 0;
#endif
diff --git a/lib/idcache.c b/lib/idcache.c
index a5f14ad..2db5109 100644
--- a/lib/idcache.c
+++ b/lib/idcache.c
@@ -46,7 +46,7 @@ struct userid
/* FIXME: provide a function to free any malloc'd storage and reset lists,
so that an application can use code like this just before exiting:
- #ifdef lint
+ #if defined GCC_LINT || defined lint
idcache_clear ();
#endif
*/
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index ba8b682..e1dbe81 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -40,7 +40,7 @@
/* Use this to suppress gcc's "...may be used before initialized" warnings.
Beware: The Code argument must not contain commas. */
#ifndef IF_LINT
-# ifdef lint
+# if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
# else
# define IF_LINT(Code) /* empty */
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 6de9b72..7426729 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -3716,7 +3716,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE
trans,
#endif
/* Build a tree for simple bracket. */
-#ifdef lint
+#if defined GCC_LINT || defined lint
memset (&br_token, 0, sizeof br_token);
#endif
br_token.type = SIMPLE_BRACKET;
@@ -3812,7 +3812,7 @@ create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t
*right,
re_token_type_t type)
{
re_token_t t;
-#ifdef lint
+#if defined GCC_LINT || defined lint
memset (&t, 0, sizeof t);
#endif
t.type = type;
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 986aae2..cd78b25 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1482,7 +1482,7 @@ re_acquire_state (reg_errcode_t *err, const re_dfa_t *dfa,
re_dfastate_t *new_state;
struct re_state_table_entry *spot;
Idx i;
-#ifdef lint
+#if defined GCC_LINT || defined lint
/* Suppress bogus uninitialized-variable warnings. */
*err = REG_NOERROR;
#endif
@@ -1530,7 +1530,7 @@ re_acquire_state_context (reg_errcode_t *err, const
re_dfa_t *dfa,
re_dfastate_t *new_state;
struct re_state_table_entry *spot;
Idx i;
-#ifdef lint
+#if defined GCC_LINT || defined lint
/* Suppress bogus uninitialized-variable warnings. */
*err = REG_NOERROR;
#endif
diff --git a/lib/trigl.c b/lib/trigl.c
index ffb677a..b203d9a 100644
--- a/lib/trigl.c
+++ b/lib/trigl.c
@@ -289,7 +289,7 @@ ieee754_rem_pio2l (long double x, long double *y)
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
+#if defined LIBM_SCCS && !defined GCC_LINT && !defined lint
static char rcsid[] =
"$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $";
#endif
diff --git a/lib/trim.c b/lib/trim.c
index 6f681a7..b2e43c5 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -31,7 +31,7 @@
#include "xalloc.h"
/* Use this to suppress gcc's "...may be used before initialized" warnings. */
-#ifdef lint
+#if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 812d478..a4e8b82 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -195,7 +195,7 @@
/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
warnings in this file. Use -Dlint to suppress them. */
-#ifdef lint
+#if defined GCC_LINT || defined lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
diff --git a/lib/verify.h b/lib/verify.h
index 2f43837..5c8381d 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -263,7 +263,7 @@ template <int w>
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER
# define assume(R) __assume (R)
-#elif (defined lint \
+#elif ((defined GCC_LINT || defined lint) \
&& (__has_builtin (__builtin_trap) \
|| 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <=
__GNUC_PATCHLEVEL__))))
/* Doing it this way helps various packages when configured with
--
2.5.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Use GCC_LINT, not lint,
Paul Eggert <=