Re: compile warnings when including avltree-list and gcc-warnings is enabled

2014-09-06 Thread Dylan Cali
On Fri, Sep 5, 2014 at 10:51 AM, Paul Eggert  wrote:
> Thanks, it looks like some declarations are missing in the corresponding .h
> file, or are missing attributes that they should have.  Is that something
> you could write a patch for?

Hi Paul,

Attached is a patch for the attribute and declaration warnings.  After
fixing those the next warning that popped up is:

lib/gl_avltree_list.c: In function 'gl_avltree_list_check_invariants':
lib/gl_avltree_list.c:66:5: error: statement with no effect
[-Werror=unused-value]
 check_invariants (list->root, NULL);
 ^

I'm not sure how to proceed with this one.  It seems gcc is just
confused (the statement definitely has an effect as that function
aborts if the checks fail).  Would it be appropriate to add a pragma
to ignore the warning for that function?

Thanks,
Dylan
From b47d780b903b4ea1fcc4421c605dc2c0978c4c3c Mon Sep 17 00:00:00 2001
From: Dylan Cali 
Date: Sat, 6 Sep 2014 01:52:31 -0500
Subject: [PATCH] build: fix attribute and declaration warnings

* tests/test-avltree_list.c: Remove gl_avltree_list_check_invariants
declaration
* lib/gl_avltree_list.h: Add gl_avltree_list_check_invariants
declaration from test-avltree_list.c
* lib/gl_avltree_list.c: (check_invariants): Add pure attribute
(gl_avltree_list_check_invariants): Add const attribute
* lib/gl_anytree_list2.h: Add pure attribute to (gl_tree_node_value),
(gl_tree_next_node), (gl_tree_previous_node), (node_at),
(gl_tree_get_at)
---
 lib/gl_anytree_list2.h| 10 +-
 lib/gl_avltree_list.c |  4 ++--
 lib/gl_avltree_list.h |  1 +
 tests/test-avltree_list.c |  2 --
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h
index 70e59a5..05fde15 100644
--- a/lib/gl_anytree_list2.h
+++ b/lib/gl_anytree_list2.h
@@ -59,7 +59,7 @@ gl_tree_size (gl_list_t list)
   return (list->root != NULL ? list->root->branch_size : 0);
 }
 
-static const void *
+static const void * _GL_ATTRIBUTE_PURE
 gl_tree_node_value (gl_list_t list, gl_list_node_t node)
 {
   return node->value;
@@ -100,7 +100,7 @@ gl_tree_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
   return 0;
 }
 
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 gl_tree_next_node (gl_list_t list, gl_list_node_t node)
 {
   if (node->right != NULL)
@@ -118,7 +118,7 @@ gl_tree_next_node (gl_list_t list, gl_list_node_t node)
   return node;
 }
 
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 gl_tree_previous_node (gl_list_t list, gl_list_node_t node)
 {
   if (node->left != NULL)
@@ -137,7 +137,7 @@ gl_tree_previous_node (gl_list_t list, gl_list_node_t node)
 }
 
 /* Return the node at the given position < gl_tree_size (list).  */
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 node_at (gl_list_node_t root, size_t position)
 {
   /* Here we know that root != NULL.  */
@@ -162,7 +162,7 @@ node_at (gl_list_node_t root, size_t position)
   return node;
 }
 
-static const void *
+static const void * _GL_ATTRIBUTE_PURE
 gl_tree_get_at (gl_list_t list, size_t position)
 {
   gl_list_node_t node = list->root;
diff --git a/lib/gl_avltree_list.c b/lib/gl_avltree_list.c
index 1afe5ca..31ed334 100644
--- a/lib/gl_avltree_list.c
+++ b/lib/gl_avltree_list.c
@@ -37,7 +37,7 @@
 #include "gl_anytree_list2.h"
 
 /* For debugging.  */
-static unsigned int
+static unsigned int _GL_ATTRIBUTE_PURE
 check_invariants (gl_list_node_t node, gl_list_node_t parent)
 {
   unsigned int left_height =
@@ -59,7 +59,7 @@ check_invariants (gl_list_node_t node, gl_list_node_t parent)
 
   return 1 + (left_height > right_height ? left_height : right_height);
 }
-void
+void _GL_ATTRIBUTE_CONST
 gl_avltree_list_check_invariants (gl_list_t list)
 {
   if (list->root != NULL)
diff --git a/lib/gl_avltree_list.h b/lib/gl_avltree_list.h
index 7f09ff3..e8300f1 100644
--- a/lib/gl_avltree_list.h
+++ b/lib/gl_avltree_list.h
@@ -24,6 +24,7 @@
 extern "C" {
 #endif
 
+extern void gl_avltree_list_check_invariants (gl_list_t list);
 extern const struct gl_list_implementation gl_avltree_list_implementation;
 #define GL_AVLTREE_LIST &gl_avltree_list_implementation
 
diff --git a/tests/test-avltree_list.c b/tests/test-avltree_list.c
index 1c0331a..c877c09 100644
--- a/tests/test-avltree_list.c
+++ b/tests/test-avltree_list.c
@@ -25,8 +25,6 @@
 #include "progname.h"
 #include "macros.h"
 
-extern void gl_avltree_list_check_invariants (gl_list_t list);
-
 static const char *objects[15] =
   {
 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"
-- 
2.1.0



Re: [PATCH v2] gnulib-tool: Download PO files

2014-09-06 Thread Mathieu Anquetin
Thanks for applying.

Best regards,
Mathieu
Le 6 sept. 2014 02:18, "Ben Pfaff"  a écrit :

> On Thu, Sep 04, 2014 at 05:41:08PM +0200, Mathieu Anquetin wrote:
> > On Thu, Sep 4, 2014 at 5:12 PM, Ben Pfaff  wrote:
> > > On Thu, Sep 04, 2014 at 08:54:47AM +0200, Mathieu Anquetin wrote:
> > >> These two patches change the behavior of gnulib-tool for downloading
> PO
> > >> files from the Translation Project. It synces it with what is being
> done
> > >> by the build-aux/bootstrap script (falling back to wget when rsync
> > >> isn't available and setting options)
> > >
> > > These look good to me.  Have you tested them?
> >
> > rsync didn't work for me (don't know if it's a firewall or a server
> > issue though), so yes I have tested them (at least, the wget part). I
> > don't think there should be any problem since the code is similar to
> > what build-aux/bootstrap does (I didn't reinvent the wheel).
> >
> > > Do you have gnulib commit
> > > rights or do you need someone to commit them for you?
> >
> > Never commited before (first contribution) so I don't think I have
> > commit rights. Maybe I am wrong though.
>
> Thanks, I applied these to the repository.  I marked them as "trivial
> changes" in the change log.  This does not mean that they were trivial
> problems or solutions but that we judged the changes to be small enough
> to be insignificant for copyright purposes.
>


Re: compile warnings when including avltree-list and gcc-warnings is enabled

2014-09-06 Thread Paul Eggert

Dylan Cali wrote:

--- a/lib/gl_avltree_list.h
+++ b/lib/gl_avltree_list.h
@@ -24,6 +24,7 @@
  extern "C" {
  #endif

+extern void gl_avltree_list_check_invariants (gl_list_t list);


On second thought this doesn't look wise, as the function is not 
expected to be exported to ordinary clients, only to the test cases.  So 
let's leave the .h file alone, and put a declaration in the .c file instead.


I suppose a pragma is the way to silence the unwanted diagnostics, yes.



Re: compile warnings when including avltree-list and gcc-warnings is enabled

2014-09-06 Thread Dylan Cali
On Sat, Sep 6, 2014 at 7:30 PM, Paul Eggert  wrote:
> On second thought this doesn't look wise, as the function is not expected to
> be exported to ordinary clients, only to the test cases.  So let's leave the
> .h file alone, and put a declaration in the .c file instead.
>
> I suppose a pragma is the way to silence the unwanted diagnostics, yes.

Updated patch attached.  I moved the declaration to the .c file and
added the warning suppression for just that function.  Everything
builds without issue now.
From d8f6449d69401a820c4b3f5d45cee8c87063618c Mon Sep 17 00:00:00 2001
From: Dylan Cali 
Date: Sat, 6 Sep 2014 01:52:31 -0500
Subject: [PATCH] build: fix gcc warnings

* tests/test-avltree_list.c: Remove gl_avltree_list_check_invariants
declaration
* lib/gl_avltree_list.c: Add gl_avltree_list_check_invariants
declaration from test-avltree_list.c. Fixes gcc warning about missing
declaration.
* lib/gl_avltree_list.c: (check_invariants): Add pure attribute.
(gl_avltree_list_check_invariants): Add const attribute. Also use a gcc
pragma to ignore a false positive warning about check_invariants being a
statement with no effect.
* lib/gl_anytree_list2.h: Add pure attribute to (gl_tree_node_value),
(gl_tree_next_node), (gl_tree_previous_node), (node_at),
(gl_tree_get_at)
---
 lib/gl_anytree_list2.h| 10 +-
 lib/gl_avltree_list.c | 14 --
 tests/test-avltree_list.c |  2 --
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h
index 70e59a5..05fde15 100644
--- a/lib/gl_anytree_list2.h
+++ b/lib/gl_anytree_list2.h
@@ -59,7 +59,7 @@ gl_tree_size (gl_list_t list)
   return (list->root != NULL ? list->root->branch_size : 0);
 }
 
-static const void *
+static const void * _GL_ATTRIBUTE_PURE
 gl_tree_node_value (gl_list_t list, gl_list_node_t node)
 {
   return node->value;
@@ -100,7 +100,7 @@ gl_tree_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
   return 0;
 }
 
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 gl_tree_next_node (gl_list_t list, gl_list_node_t node)
 {
   if (node->right != NULL)
@@ -118,7 +118,7 @@ gl_tree_next_node (gl_list_t list, gl_list_node_t node)
   return node;
 }
 
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 gl_tree_previous_node (gl_list_t list, gl_list_node_t node)
 {
   if (node->left != NULL)
@@ -137,7 +137,7 @@ gl_tree_previous_node (gl_list_t list, gl_list_node_t node)
 }
 
 /* Return the node at the given position < gl_tree_size (list).  */
-static gl_list_node_t
+static gl_list_node_t _GL_ATTRIBUTE_PURE
 node_at (gl_list_node_t root, size_t position)
 {
   /* Here we know that root != NULL.  */
@@ -162,7 +162,7 @@ node_at (gl_list_node_t root, size_t position)
   return node;
 }
 
-static const void *
+static const void * _GL_ATTRIBUTE_PURE
 gl_tree_get_at (gl_list_t list, size_t position)
 {
   gl_list_node_t node = list->root;
diff --git a/lib/gl_avltree_list.c b/lib/gl_avltree_list.c
index 1afe5ca..9c408ac 100644
--- a/lib/gl_avltree_list.c
+++ b/lib/gl_avltree_list.c
@@ -36,8 +36,10 @@
 /* Generic binary tree code.  */
 #include "gl_anytree_list2.h"
 
+extern void gl_avltree_list_check_invariants (gl_list_t list);
+
 /* For debugging.  */
-static unsigned int
+static unsigned int _GL_ATTRIBUTE_PURE
 check_invariants (gl_list_node_t node, gl_list_node_t parent)
 {
   unsigned int left_height =
@@ -59,13 +61,21 @@ check_invariants (gl_list_node_t node, gl_list_node_t parent)
 
   return 1 + (left_height > right_height ? left_height : right_height);
 }
-void
+
+/* GCC warns that check_invariants has no effect, but it does. Ignore
+   the false positive. */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-value"
+
+void _GL_ATTRIBUTE_CONST
 gl_avltree_list_check_invariants (gl_list_t list)
 {
   if (list->root != NULL)
 check_invariants (list->root, NULL);
 }
 
+#pragma GCC diagnostic pop
+
 const struct gl_list_implementation gl_avltree_list_implementation =
   {
 gl_tree_nx_create_empty,
diff --git a/tests/test-avltree_list.c b/tests/test-avltree_list.c
index 1c0331a..c877c09 100644
--- a/tests/test-avltree_list.c
+++ b/tests/test-avltree_list.c
@@ -25,8 +25,6 @@
 #include "progname.h"
 #include "macros.h"
 
-extern void gl_avltree_list_check_invariants (gl_list_t list);
-
 static const char *objects[15] =
   {
 "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o"
-- 
2.1.0



[PATCH] users.txt: add cmogstored

2014-09-06 Thread Eric Wong
cmogstored has used gnulib since the beginning in 2012 to support
GNU/Linux, FreeBSD, and GNU/kFreeBSD.  cmogstored is currently
included in the FreeBSD ports collection, but developed primarily
on GNU/Linux.

Signed-off-by: Eric Wong 
---
 users.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/users.txt b/users.txt
index 5d50ce1..62c7736 100644
--- a/users.txt
+++ b/users.txt
@@ -8,6 +8,7 @@ The following packages appear to be using gnulib and 
gnulib-tool:
   bison   http://git.sv.gnu.org/gitweb/?p=bison.git
   clisp   http://clisp.cvs.sourceforge.net/clisp/clisp/
   coreutils   http://git.sv.gnu.org/gitweb/?p=coreutils.git
+  cmogstored  http://bogomips.org/cmogstored/README
   cpiohttp://git.sv.gnu.org/gitweb/?p=cpio.git
   CSSChttp://git.savannah.gnu.org/cgit/cssc.git
   cvs http://cvs.sv.gnu.org/viewcvs/cvs/ccvs/
-- 
EW