bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cleanup 64-bit warning in argp-help.c for Mac OS X 10.6


From: Jonathan Creekmore
Subject: Cleanup 64-bit warning in argp-help.c for Mac OS X 10.6
Date: Sat, 30 Apr 2011 15:02:58 -0500
User-agent: Gnus/5.110015 (No Gnus v0.15)

Another package I was trying to build threw a warning on lib/argp-help.c
on my 64-bit box. In this case, the assert statement only needs to be
compiled if SIZE_MAX <= UINT_MAX, otherwise a warning is generated in
the assert statement.

I have attached a patch. I hope this helps.

From 27b442d78074e1a043c5251732fd93fcf7937bf3 Mon Sep 17 00:00:00 2001
From: Jonathan Creekmore <address@hidden>
Date: Sat, 30 Apr 2011 14:53:23 -0500
Subject: The assert statement does not need to be compiled if SIZE_MAX > 
UINT_MAX. This keeps a warning from being generated on 64-bit architectures.

---
 lib/argp-help.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/argp-help.c b/lib/argp-help.c
index 48c37a9..505eccc 100644
--- a/lib/argp-help.c
+++ b/lib/argp-help.c
@@ -463,8 +463,9 @@ make_hol (const struct argp *argp, struct hol_cluster 
*cluster)
       hol->short_options = malloc (num_short_options + 1);
 
       assert (hol->entries && hol->short_options);
-      if (SIZE_MAX <= UINT_MAX)
-        assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#if (SIZE_MAX <= UINT_MAX)
+      assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#endif
 
       /* Fill in the entries.  */
       so = hol->short_options;
@@ -879,8 +880,9 @@ hol_append (struct hol *hol, struct hol *more)
             malloc (hol_so_len + strlen (more->short_options) + 1);
 
           assert (entries && short_options);
-          if (SIZE_MAX <= UINT_MAX)
-            assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#if (SIZE_MAX <= UINT_MAX)
+          assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#endif
 
           __mempcpy (__mempcpy (entries, hol->entries,
                                 hol->num_entries * sizeof (struct hol_entry)),
-- 
1.7.4.1

-- 
Jonathan Creekmore
address@hidden

Attachment: pgphLeVugBEPa.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]