From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 7C2861F55B for ; Sun, 31 May 2020 10:44:03 +0000 (UTC) Received: from localhost ([::1]:54008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfLRi-0005AI-DQ for normalperson@yhbt.net; Sun, 31 May 2020 06:44:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfLRg-0005AA-8x for bug-gnulib@gnu.org; Sun, 31 May 2020 06:44:00 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:55788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfLRf-0000xR-44 for bug-gnulib@gnu.org; Sun, 31 May 2020 06:43:59 -0400 Received: by mail-wm1-x32c.google.com with SMTP id c71so7998171wmd.5 for ; Sun, 31 May 2020 03:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8F+0MIlcS8Ry+RX4UY1tsdYE/40oIPnWG4X6sBWaYy4=; b=kp1l1PG41mn0TmS87/AriMYNaTR+P2l4Ix7jEvmvo9/zvw0S/Rflo7XgjjzxeUsnE5 ZIRilDhuemnESLxVrIiJhVCFeVfzXL11qhiVQXJCP7uSkmI4ovoH1DM66NPkvuyNdDXj a1oY0pBgYbc6P3GL/w6M3tcYlp5zQA/hAxh4/RSNxKME4TYvRXc8RXcjC02gTwMc6t6h Wnr5Q8U9WM430V9MKH+BAA1+motSGkTWNbp+hvdpGy+J1FQcWKPskX5kwSUtAMkr9avX wYOKDQUb/GbhvbfciAL5iKpFDEoVTidmX6qH+LrMD0YNADngD7Qc04IK5xuT0nQwd3dc ZuuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=8F+0MIlcS8Ry+RX4UY1tsdYE/40oIPnWG4X6sBWaYy4=; b=FduN0O4bzmrFMJB2fCOLOzr5ugEDYEjrFUbBXn6QF3VcoL9s9aHJ95asR7qJukYBjc RezbG83iI3XNExoWQDs5GXqXhJpScNwa7sqvT3h60uYVq0rIyl5zEQAUGfOn1OF2yG83 8ZN6NXof05SmKAtfoUvaW+mzx3yaA6bgZETs40/HZnG9Uejo1LTOvdKRhq+0YPMnQcon YfxLZjGoFQvG4MmTszwcUHgTW+KllpJRlhQ/810C3Abcp2yJlIMGfmhIHRZKBDRyo6Hg tblQs57HRyD53KGxNhXAz3Wqph6yJPd88sQatMGLvI2zNJKt23aQboq9TnYng9L2njl8 3U7Q== X-Gm-Message-State: AOAM531LNCOBnfzW2JOC8GrBDLwm/kjzGxR4AlNskCZQOuRv3xNSn1s+ Gcxx7hTNtKLgguarOiBKFf0= X-Google-Smtp-Source: ABdhPJzjN1ummgGOqTIIwEvk7B7PLSVG3zWSFq8WzYVwKVbC5l8kJG0TqQycOtJ4/Up2Cp8G5MTZWw== X-Received: by 2002:a1c:c3d7:: with SMTP id t206mr17200499wmf.69.1590921837643; Sun, 31 May 2020 03:43:57 -0700 (PDT) Received: from ?IPv6:2a01:e35:2fd9:96a0:3826:dfbf:20bd:f5c7? ([2a01:e35:2fd9:96a0:3826:dfbf:20bd:f5c7]) by smtp.gmail.com with ESMTPSA id i10sm907475wrw.51.2020.05.31.03.43.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 May 2020 03:43:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: list: fix GCC warnings From: Akim Demaille In-Reply-To: <2524825.qb9ItadjnO@omega> Date: Sun, 31 May 2020 12:43:53 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <5E88488D-0BED-4E89-904B-4EAA25CBBA24@gmail.com> References: <2524825.qb9ItadjnO@omega> To: Bruno Haible X-Mailer: Apple Mail (2.3445.104.14) Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=akim.demaille@gmail.com; helo=mail-wm1-x32c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" > Le 31 mai 2020 =C3=A0 11:28, Bruno Haible a =C3=A9crit= : >=20 > Hi Akim, >=20 > Thanks for caring about these warnings. Sure! >> * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using >> the same variable name in nested scopes. >=20 > 'p' is a poor variable name here. Please, can use you 'nodes_elt' = instead? Good with me. >> I don't think the MAYBE_UNUSED attribute may harm in any way, but if = we >> want to avoid that, the simplest would probably be to move the #if = outside >> and implement the function twice. >=20 > Better use _GL_ATTRIBUTE_MAYBE_UNUSED. Implementing the function twice = means > - duplicating the parameter list, > - having no proper place for attaching a comment to the function. Very much agreed. Installed as follows. Cheers! commit d8a8fb3423499851bf06aac2302112944a276f97 Author: Akim Demaille Date: Sun May 31 08:59:25 2020 +0200 list: fix GCC warnings =20 * lib/gl_anytree_list2.h (gl_tree_iterator_free) (gl_tree_next_node, gl_tree_node_nx_set_value) (gl_tree_previous_node, gl_tree_next_node): Mark unused arguments. * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. * lib/gl_anylinked_list2.h (gl_linked_node_value) (gl_linked_node_nx_set_value, gl_linked_iterator_free): Likewise. =20 * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using the same variable name in nested scopes. diff --git a/ChangeLog b/ChangeLog index 321d5e28c..5ef05e037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2020-05-31 Akim Demaille + + list: fix GCC warnings + * lib/gl_anytree_list2.h (gl_tree_iterator_free) + (gl_tree_next_node, gl_tree_node_nx_set_value) + (gl_tree_previous_node, gl_tree_next_node): + Mark unused arguments. + * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. + * lib/gl_anylinked_list2.h (gl_linked_node_value) + (gl_linked_node_nx_set_value, gl_linked_iterator_free): = Likewise. + + * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid = using + the same variable name in nested scopes. + 2020-05-31 Bruno Haible =20 list-c++, set-c++, oset-c++, map-c++, omap-c++: Don't fool the = compiler. diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h index 114106c7d..3e01f8fa0 100644 --- a/lib/gl_anylinked_list2.h +++ b/lib/gl_anylinked_list2.h @@ -76,11 +76,11 @@ gl_linked_nx_create_empty (gl_list_implementation_t = implementation, =20 static gl_list_t gl_linked_nx_create (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - gl_listelement_dispose_fn dispose_fn, - bool allow_duplicates, - size_t count, const void **contents) + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) { struct gl_list_impl *list =3D (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl)); @@ -170,13 +170,15 @@ gl_linked_size (gl_list_t list) } =20 static const void * _GL_ATTRIBUTE_PURE -gl_linked_node_value (gl_list_t list, gl_list_node_t node) +gl_linked_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { return node->value; } =20 static int -gl_linked_node_nx_set_value (gl_list_t list, gl_list_node_t node, +gl_linked_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node, const void *elt) { #if WITH_HASHTABLE @@ -1021,7 +1023,7 @@ gl_linked_iterator_next (gl_list_iterator_t = *iterator, } =20 static void -gl_linked_iterator_free (gl_list_iterator_t *iterator) +gl_linked_iterator_free (gl_list_iterator_t *iterator = _GL_ATTRIBUTE_MAYBE_UNUSED) { } =20 diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h index c5a67dbd0..939b79748 100644 --- a/lib/gl_anytree_list2.h +++ b/lib/gl_anytree_list2.h @@ -60,13 +60,15 @@ gl_tree_size (gl_list_t list) } =20 static const void * -gl_tree_node_value (gl_list_t list, gl_list_node_t node) +gl_tree_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { return node->value; } =20 static int -gl_tree_node_nx_set_value (gl_list_t list, gl_list_node_t node, const = void *elt) +gl_tree_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node, const void *elt) { #if WITH_HASHTABLE if (elt !=3D node->value) @@ -101,7 +103,8 @@ gl_tree_node_nx_set_value (gl_list_t list, = gl_list_node_t node, const void *elt) } =20 static gl_list_node_t _GL_ATTRIBUTE_PURE -gl_tree_next_node (gl_list_t list, gl_list_node_t node) +gl_tree_next_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { if (node->right !=3D NULL) { @@ -119,7 +122,8 @@ gl_tree_next_node (gl_list_t list, gl_list_node_t = node) } =20 static gl_list_node_t _GL_ATTRIBUTE_PURE -gl_tree_previous_node (gl_list_t list, gl_list_node_t node) +gl_tree_previous_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { if (node->left !=3D NULL) { @@ -628,7 +632,7 @@ gl_tree_iterator_next (gl_list_iterator_t *iterator, } =20 static void -gl_tree_iterator_free (gl_list_iterator_t *iterator) +gl_tree_iterator_free (gl_list_iterator_t *iterator = _GL_ATTRIBUTE_MAYBE_UNUSED) { } =20 diff --git a/lib/gl_anytree_oset.h b/lib/gl_anytree_oset.h index e837f6324..d737e313d 100644 --- a/lib/gl_anytree_oset.h +++ b/lib/gl_anytree_oset.h @@ -292,6 +292,6 @@ gl_tree_iterator_next (gl_oset_iterator_t *iterator, = const void **eltp) } =20 static void -gl_tree_iterator_free (gl_oset_iterator_t *iterator) +gl_tree_iterator_free (gl_oset_iterator_t *iterator = _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytreehash_list2.h b/lib/gl_anytreehash_list2.h index 69e6776b0..26e52bf38 100644 --- a/lib/gl_anytreehash_list2.h +++ b/lib/gl_anytreehash_list2.h @@ -61,13 +61,13 @@ gl_tree_search_from_to (gl_list_t list, size_t = start_index, size_t end_index, { /* We have to return only the one at the = minimal position >=3D start_index. */ - const void *elt; + const void *nodes_elt; if (gl_oset_search_atleast (nodes, = compare_position_threshold, (void = *)(uintptr_t)start_index, - &elt)) + &nodes_elt)) { - node =3D (gl_list_node_t) elt; + node =3D (gl_list_node_t) nodes_elt; if (end_index =3D=3D = list->root->branch_size || node_position (node) < end_index) return node;