unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: avoid warning with -Wall
@ 2022-04-18 14:48 michaeljgruber+grubix+git
  2022-04-19 19:25 ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: michaeljgruber+grubix+git @ 2022-04-18 14:48 UTC (permalink / raw)
  To: notmuch; +Cc: Michael J Gruber

From: Michael J Gruber <git@grubix.eu>

7228fe68 ("configure: restructure gmime cert validity checker code",
2022-04-09) restructured generated C code to repurpose it later on. This
put usage of `validity` within an `#if`, resulting in an "unused
warning" if that `#if` is not executed.

Put the variable declariation inside the same if branch and, thus,  quel
the warning.

Signed-off-by: Michael J Gruber <git@grubix.eu>
---
Purely cosmetic. There are more warnings during the build, but this was
the only one during configure, so it stuck out a bit.

 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 2f6d8b68..30fee6ab 100755
--- a/configure
+++ b/configure
@@ -564,7 +564,6 @@ int main () {
     GMimeSignature *sig = NULL;
     GMimeCertificate *cert = NULL;
     GMimeObject *output = NULL;
-    GMimeValidity validity = GMIME_VALIDITY_UNKNOWN;
     int len;
 
     g_mime_init ();
@@ -586,7 +585,7 @@ int main () {
     cert = g_mime_signature_get_certificate (sig);
     if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n");
 #ifdef CHECK_VALIDITY
-    validity = g_mime_certificate_get_id_validity (cert);
+    GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
     if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
 #endif
 #ifdef CHECK_EMAIL
-- 
2.36.0.rc2.472.gf6a51f5f41

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: avoid warning with -Wall
  2022-04-18 14:48 [PATCH] configure: avoid warning with -Wall michaeljgruber+grubix+git
@ 2022-04-19 19:25 ` Tomi Ollila
  2022-04-19 20:16   ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2022-04-19 19:25 UTC (permalink / raw)
  To: michaeljgruber+grubix+git, notmuch; +Cc: Michael J Gruber

On Mon, Apr 18 2022, michaeljgruber wrote:

> From: Michael J Gruber <git@grubix.eu>
>
> 7228fe68 ("configure: restructure gmime cert validity checker code",
> 2022-04-09) restructured generated C code to repurpose it later on. This
> put usage of `validity` within an `#if`, resulting in an "unused
> warning" if that `#if` is not executed.
>
> Put the variable declariation inside the same if branch and, thus,  quel
> the warning.

IMO the code could be changed to be even more RAIIy (even so that is not
common style there), also IMO removing warning is good enough reason to
deviate from that style (just in one place) so LGTM from me :D

Tomi

>
> Signed-off-by: Michael J Gruber <git@grubix.eu>
> ---
> Purely cosmetic. There are more warnings during the build, but this was
> the only one during configure, so it stuck out a bit.
>
>  configure | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 2f6d8b68..30fee6ab 100755
> --- a/configure
> +++ b/configure
> @@ -564,7 +564,6 @@ int main () {
>      GMimeSignature *sig = NULL;
>      GMimeCertificate *cert = NULL;
>      GMimeObject *output = NULL;
> -    GMimeValidity validity = GMIME_VALIDITY_UNKNOWN;
>      int len;
>  
>      g_mime_init ();
> @@ -586,7 +585,7 @@ int main () {
>      cert = g_mime_signature_get_certificate (sig);
>      if (cert == NULL) return !! fprintf (stderr, "no GMimeCertificate found\n");
>  #ifdef CHECK_VALIDITY
> -    validity = g_mime_certificate_get_id_validity (cert);
> +    GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
>      if (validity != GMIME_VALIDITY_FULL) return !! fprintf (stderr, "Got validity %d, expected %d\n", validity, GMIME_VALIDITY_FULL);
>  #endif
>  #ifdef CHECK_EMAIL
> -- 
> 2.36.0.rc2.472.gf6a51f5f41
>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: avoid warning with -Wall
  2022-04-19 19:25 ` Tomi Ollila
@ 2022-04-19 20:16   ` David Bremner
  0 siblings, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-04-19 20:16 UTC (permalink / raw)
  To: Tomi Ollila, michaeljgruber+grubix+git, notmuch; +Cc: Michael J Gruber

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Mon, Apr 18 2022, michaeljgruber wrote:
>
>> From: Michael J Gruber <git@grubix.eu>
>>
>> 7228fe68 ("configure: restructure gmime cert validity checker code",
>> 2022-04-09) restructured generated C code to repurpose it later on. This
>> put usage of `validity` within an `#if`, resulting in an "unused
>> warning" if that `#if` is not executed.
>>
>> Put the variable declariation inside the same if branch and, thus,  quel
>> the warning.
>
> IMO the code could be changed to be even more RAIIy (even so that is not
> common style there), also IMO removing warning is good enough reason to
> deviate from that style (just in one place) so LGTM from me :D
>
> Tomi

applied to master.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-19 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 14:48 [PATCH] configure: avoid warning with -Wall michaeljgruber+grubix+git
2022-04-19 19:25 ` Tomi Ollila
2022-04-19 20:16   ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).