changeset 18325:33db65a13e67

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 30 May 2016 12:18:19 -0700
parents d069a85b1ccd
children 531eb5d80adc
files ChangeLog doc/posix-headers/stdnoreturn.texi lib/diffseq.h lib/fts.c lib/getndelim2.c lib/gl_anylinked_list2.h lib/gl_anytree_list2.h lib/gl_anytree_oset.h lib/gl_array_list.c lib/gl_array_oset.c lib/gl_carray_list.c lib/idcache.c lib/inet_ntop.c lib/regcomp.c lib/regex_internal.c lib/trigl.c lib/trim.c lib/vasnprintf.c lib/verify.h
diffstat 19 files changed, 61 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 29 12:54:32 2016 +0200
+++ b/ChangeLog	Mon May 30 12:18:19 2016 -0700
@@ -1,3 +1,34 @@
+2016-05-30  Paul Eggert  <eggert@cs.ucla.edu>
+
+	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  <bruno@clisp.org>
 
 	secure_getenv: Port to many more platforms.
--- a/doc/posix-headers/stdnoreturn.texi	Sun May 29 12:54:32 2016 +0200
+++ b/doc/posix-headers/stdnoreturn.texi	Mon May 30 12:18:19 2016 -0700
@@ -22,6 +22,11 @@
 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
--- a/lib/diffseq.h	Sun May 29 12:54:32 2016 +0200
+++ b/lib/diffseq.h	Mon May 30 12:18:19 2016 -0700
@@ -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 */
--- a/lib/fts.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/fts.c	Mon May 30 12:18:19 2016 -0700
@@ -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"
 
--- a/lib/getndelim2.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/getndelim2.c	Mon May 30 12:18:19 2016 -0700
@@ -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 */
--- a/lib/gl_anylinked_list2.h	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_anylinked_list2.h	Mon May 30 12:18:19 2016 -0700
@@ -923,7 +923,7 @@
   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 @@
       result.q = node;
     }
 
-#ifdef lint
+#if defined GCC_LINT || defined lint
   result.i = 0;
   result.j = 0;
   result.count = 0;
--- a/lib/gl_anytree_list2.h	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_anytree_list2.h	Mon May 30 12:18:19 2016 -0700
@@ -564,7 +564,7 @@
   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 @@
   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;
--- a/lib/gl_anytree_oset.h	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_anytree_oset.h	Mon May 30 12:18:19 2016 -0700
@@ -255,7 +255,7 @@
   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;
--- a/lib/gl_array_list.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_array_list.c	Mon May 30 12:18:19 2016 -0700
@@ -454,7 +454,7 @@
   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 @@
   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
--- a/lib/gl_array_oset.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_array_oset.c	Mon May 30 12:18:19 2016 -0700
@@ -303,7 +303,7 @@
   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
--- a/lib/gl_carray_list.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/gl_carray_list.c	Mon May 30 12:18:19 2016 -0700
@@ -624,7 +624,7 @@
   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 @@
   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
--- a/lib/idcache.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/idcache.c	Mon May 30 12:18:19 2016 -0700
@@ -46,7 +46,7 @@
 
 /* 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
 */
--- a/lib/inet_ntop.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/inet_ntop.c	Mon May 30 12:18:19 2016 -0700
@@ -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 */
--- a/lib/regcomp.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/regcomp.c	Mon May 30 12:18:19 2016 -0700
@@ -3716,7 +3716,7 @@
 #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 @@
 	     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;
--- a/lib/regex_internal.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/regex_internal.c	Mon May 30 12:18:19 2016 -0700
@@ -1482,7 +1482,7 @@
   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_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
--- a/lib/trigl.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/trigl.c	Mon May 30 12:18:19 2016 -0700
@@ -289,7 +289,7 @@
  * ====================================================
  */
 
-#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
--- a/lib/trim.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/trim.c	Mon May 30 12:18:19 2016 -0700
@@ -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 */
--- a/lib/vasnprintf.c	Sun May 29 12:54:32 2016 +0200
+++ b/lib/vasnprintf.c	Mon May 30 12:18:19 2016 -0700
@@ -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 */
--- a/lib/verify.h	Sun May 29 12:54:32 2016 +0200
+++ b/lib/verify.h	Mon May 30 12:18:19 2016 -0700
@@ -263,7 +263,7 @@
 # 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