From: Paul Eggert Date: Mon, 30 May 2016 19:18:19 +0000 (-0700) Subject: Use GCC_LINT, not lint X-Git-Tag: v1.0~6733 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=96609bb2f79ad9f9f12669af0cabf3d2947046b6;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 8189f4cdca..8525a803bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2016-05-30 Paul Eggert + + 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 secure_getenv: Port to many more platforms. diff --git a/doc/posix-headers/stdnoreturn.texi b/doc/posix-headers/stdnoreturn.texi index 19722bd1a3..1bb50b8d3b 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 +@code{_Noreturn} (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. +@item 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 d1a562d6c9..6be7d83827 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 2c9df2fb88..bcdcff9bb7 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -46,9 +46,9 @@ #include -#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 b8bc98ffdb..44424c68f6 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 6250c2bc3b..a1037ede2f 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 b7ce99d170..7e6fe4522c 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 97464cb733..127f4e338e 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 098d8af38e..66cf34bc10 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 2bc970f9cc..92e69cc366 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 1e2b453a34..694b09a764 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 a5f14adaf6..2db5109b4c 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 ba8b682cfc..e1dbe81026 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 6de9b72970..74267292d6 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 986aae2a86..cd78b252a3 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 ffb677ae6c..b203d9a17e 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 6f681a7fbf..b2e43c5a1c 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 812d478a64..a4e8b82b82 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 2f4383743b..5c8381d290 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -263,7 +263,7 @@ template # 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