SF.net SVN: gar:[23747] csw/mgar/pkg/coreutils/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sun Jun 1 22:04:32 CEST 2014


Revision: 23747
          http://sourceforge.net/p/gar/code/23747
Author:   bdwalton
Date:     2014-06-01 20:04:28 +0000 (Sun, 01 Jun 2014)
Log Message:
-----------
coreutils/trunk: revert to default GNU compiler; add patches for (now strict errors) compiler warnings

Modified Paths:
--------------
    csw/mgar/pkg/coreutils/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/coreutils/trunk/files/0001-Backport-some-patches-to-suppress-compiler-errors.patch
    csw/mgar/pkg/coreutils/trunk/files/0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch
    csw/mgar/pkg/coreutils/trunk/files/0003-Only-define-the-out-label-if-it-will-be-used.patch
    csw/mgar/pkg/coreutils/trunk/files/0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch
    csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-Prevent-compiler-warning-by-removing-block.patch

Modified: csw/mgar/pkg/coreutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/coreutils/trunk/Makefile	2014-06-01 19:29:04 UTC (rev 23746)
+++ csw/mgar/pkg/coreutils/trunk/Makefile	2014-06-01 20:04:28 UTC (rev 23747)
@@ -8,7 +8,7 @@
 # OPT_FLAGS_GCC = -O1 -pipe
 
 # building with gcc gets us extra tools (eg: stdbuf)
-GARCOMPILER = GCC4
+GARCOMPILER = GNU
 
 SHELL = /opt/csw/bin/bash
 
@@ -32,6 +32,13 @@
 MASTER_SITES = $(GNU_MIRROR)
 DISTFILES = $(NAME)-$(VERSION).tar.xz
 
+
+PATCHFILES += 0001-Backport-some-patches-to-suppress-compiler-errors.patch
+PATCHFILES += 0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch
+PATCHFILES += 0003-Only-define-the-out-label-if-it-will-be-used.patch
+PATCHFILES += 0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch
+
+
 # We define upstream file regex so we can be notifed of new upstream
 # software release
 UFILES_REGEX = $(NAME)-(\d+(?:\.\d+)*).tar.gz

Added: csw/mgar/pkg/coreutils/trunk/files/0001-Backport-some-patches-to-suppress-compiler-errors.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0001-Backport-some-patches-to-suppress-compiler-errors.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0001-Backport-some-patches-to-suppress-compiler-errors.patch	2014-06-01 20:04:28 UTC (rev 23747)
@@ -0,0 +1,51 @@
+From 5d13bcc51f639f4106d90206001bc5f6529b2aa5 Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sat, 31 May 2014 20:50:02 +0200
+Subject: [PATCH] Backport some patches to suppress compiler errors.
+
+We need to suppress suggest-attribute=(const|pure) in a few cases.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ lib/fadvise.c      | 6 ++++++
+ lib/file-has-acl.c | 7 +++++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/lib/fadvise.c b/lib/fadvise.c
+index 8d3af99..5b4c916 100644
+--- a/lib/fadvise.c
++++ b/lib/fadvise.c
+@@ -14,6 +14,12 @@
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+ 
++/* Without this pragma, gcc suggests that (given !HAVE_POSIX_FADVISE)
++   the the fdadvise function might be candidate for attribute 'const'.  */
++#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
++# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
++#endif
++
+ #include <config.h>
+ #include "fadvise.h"
+ 
+diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
+index bb8bae1..7ea4569 100644
+--- a/lib/file-has-acl.c
++++ b/lib/file-has-acl.c
+@@ -23,6 +23,13 @@
+ # pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+ #endif
+ 
++/* Without this pragma, gcc 4.9 may suggest that the acl_nontrivial
++   and acl_ace_nontrivial functions might be candidates for
++   attribute 'pure'                                                */
++#if (__GNUC__ == 4 && 9 <= __GNUC_MINOR__) || 4 < __GNUC__
++# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
++#endif
++
+ #include <config.h>
+ 
+ #include "acl.h"
+-- 
+1.8.4.1
+

Added: csw/mgar/pkg/coreutils/trunk/files/0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0002-Avoid-compiler-error-by-casting-the-ignore-option-fr.patch	2014-06-01 20:04:28 UTC (rev 23747)
@@ -0,0 +1,32 @@
+From b97eb8aa1e715da0c308460c2f33304968d161b1 Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sun, 1 Jun 2014 10:02:30 +0200
+Subject: [PATCH] Avoid compiler error by casting the ignore option from const
+ char
+
+The hasmntopt definition on Solaris expects the desired option to be a
+char *, but passes a defined constant string. With all errors enabled,
+this causes the build to fail. As a hack, cast the constant string to
+char *.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ lib/mountlist.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/mountlist.c b/lib/mountlist.c
+index b839cd1..74fb548 100644
+--- a/lib/mountlist.c
++++ b/lib/mountlist.c
+@@ -134,7 +134,7 @@
+ 
+ #undef MNT_IGNORE
+ #ifdef MNTOPT_IGNORE
+-# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
++# define MNT_IGNORE(M) hasmntopt (M, (char *) MNTOPT_IGNORE)
+ #else
+ # define MNT_IGNORE(M) 0
+ #endif
+-- 
+1.8.4.1
+

Added: csw/mgar/pkg/coreutils/trunk/files/0003-Only-define-the-out-label-if-it-will-be-used.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0003-Only-define-the-out-label-if-it-will-be-used.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0003-Only-define-the-out-label-if-it-will-be-used.patch	2014-06-01 20:04:28 UTC (rev 23747)
@@ -0,0 +1,31 @@
+From 1f41af243a161a1591bbca78890dd63c04098b41 Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sun, 1 Jun 2014 10:31:35 +0200
+Subject: [PATCH 4/4] Only define the out label if it will be used.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ lib/rename.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/rename.c b/lib/rename.c
+index 3e463ea..7822a63 100644
+--- a/lib/rename.c
++++ b/lib/rename.c
+@@ -462,7 +462,13 @@ rpl_rename (char const *src, char const *dst)
+ 
+   ret_val = rename (src_temp, dst_temp);
+   rename_errno = errno;
++# if (RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG        \
++      || RENAME_HARD_LINK_BUG)
++  /* Avoid compiler warnings from gcc 4.9 about unused labels. Only
++     create this label if it will be used. */
+  out:
++# endif
++
+   if (src_temp != src)
+     free (src_temp);
+   if (dst_temp != dst)
+-- 
+1.8.4.1
+

Added: csw/mgar/pkg/coreutils/trunk/files/0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0004-Ensure-that-dst_exists-is-used-in-all-cases-to-avoid.patch	2014-06-01 20:04:28 UTC (rev 23747)
@@ -0,0 +1,31 @@
+From b6215948bf81b5e866ad83f96768eae36a32f273 Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sun, 1 Jun 2014 10:50:41 +0200
+Subject: [PATCH] Ensure that dst_exists is used in all cases to avoid compiler
+ issues.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ lib/rename.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/rename.c b/lib/rename.c
+index 7822a63..75ecc68 100644
+--- a/lib/rename.c
++++ b/lib/rename.c
+@@ -458,6 +458,12 @@ rpl_rename (char const *src, char const *dst)
+           goto out;
+         }
+     }
++# else
++  /* Avoid compiler warnings/errors for -Werror=unused-but-set-variable */
++  if (dst_exists)
++    {
++      ;
++    }
+ # endif /* RENAME_DEST_EXISTS_BUG */
+ 
+   ret_val = rename (src_temp, dst_temp);
+-- 
+1.8.4.1
+

Added: csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-Prevent-compiler-warning-by-removing-block.patch
===================================================================
--- csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-Prevent-compiler-warning-by-removing-block.patch	                        (rev 0)
+++ csw/mgar/pkg/coreutils/trunk/files/0005-src-df.c-Prevent-compiler-warning-by-removing-block.patch	2014-06-01 20:04:28 UTC (rev 23747)
@@ -0,0 +1,124 @@
+From 947aa78883636ef8e2469d1a89e8e6cb7a142dff Mon Sep 17 00:00:00 2001
+From: Ben Walton <bwalton at opencsw.org>
+Date: Sun, 1 Jun 2014 19:55:24 +0200
+Subject: [PATCH] src/df.c: Prevent compiler warning by removing block
+
+gcc 4.9.0 thinks that v may be uninitialized due to the block around the options in a switch/case statement.
+
+Signed-off-by: Ben Walton <bwalton at opencsw.org>
+---
+ src/df.c | 98 +++++++++++++++++++++++++++++++---------------------------------
+ 1 file changed, 48 insertions(+), 50 deletions(-)
+
+diff --git a/src/df.c b/src/df.c
+index 969670e..10541a8 100644
+--- a/src/df.c
++++ b/src/df.c
+@@ -967,56 +967,54 @@ get_dev (char const *disk, char const *mount_point, char const* file,
+ 
+         case PCENT_FIELD:
+         case IPCENT_FIELD:
+-          {
+-            double pct = -1;
+-            if (! known_value (v->used) || ! known_value (v->available))
+-              ;
+-            else if (!v->negate_used
+-                     && v->used <= TYPE_MAXIMUM (uintmax_t) / 100
+-                     && v->used + v->available != 0
+-                     && (v->used + v->available < v->used)
+-                     == v->negate_available)
+-              {
+-                uintmax_t u100 = v->used * 100;
+-                uintmax_t nonroot_total = v->used + v->available;
+-                pct = u100 / nonroot_total + (u100 % nonroot_total != 0);
+-              }
+-            else
+-              {
+-                /* The calculation cannot be done easily with integer
+-                   arithmetic.  Fall back on floating point.  This can suffer
+-                   from minor rounding errors, but doing it exactly requires
+-                   multiple precision arithmetic, and it's not worth the
+-                   aggravation.  */
+-                double u = v->negate_used ? - (double) - v->used : v->used;
+-                double a = v->negate_available
+-                           ? - (double) - v->available : v->available;
+-                double nonroot_total = u + a;
+-                if (nonroot_total)
+-                  {
+-                    long int lipct = pct = u * 100 / nonroot_total;
+-                    double ipct = lipct;
+-
+-                    /* Like 'pct = ceil (dpct);', but avoid ceil so that
+-                       the math library needn't be linked.  */
+-                    if (ipct - 1 < pct && pct <= ipct + 1)
+-                      pct = ipct + (ipct < pct);
+-                  }
+-              }
+-
+-            if (0 <= pct)
+-              {
+-                if (asprintf (&cell, "%.0f%%", pct) == -1)
+-                  cell = NULL;
+-              }
+-            else
+-              cell = strdup ("-");
+-
+-            if (!cell)
+-              xalloc_die ();
+-
+-            break;
+-          }
++	  double pct = -1;
++	  if (! known_value (v->used) || ! known_value (v->available))
++	    ;
++	  else if (!v->negate_used
++		   && v->used <= TYPE_MAXIMUM (uintmax_t) / 100
++		   && v->used + v->available != 0
++		   && (v->used + v->available < v->used)
++		   == v->negate_available)
++	    {
++	      uintmax_t u100 = v->used * 100;
++	      uintmax_t nonroot_total = v->used + v->available;
++	      pct = u100 / nonroot_total + (u100 % nonroot_total != 0);
++	    }
++	  else
++	    {
++	      /* The calculation cannot be done easily with integer
++		 arithmetic.  Fall back on floating point.  This can suffer
++		 from minor rounding errors, but doing it exactly requires
++		 multiple precision arithmetic, and it's not worth the
++		 aggravation.  */
++	      double u = v->negate_used ? - (double) - v->used : v->used;
++	      double a = v->negate_available
++		         ? - (double) - v->available : v->available;
++	      double nonroot_total = u + a;
++	      if (nonroot_total)
++		{
++		  long int lipct = pct = u * 100 / nonroot_total;
++		  double ipct = lipct;
++
++		  /* Like 'pct = ceil (dpct);', but avoid ceil so that
++		     the math library needn't be linked.  */
++		  if (ipct - 1 < pct && pct <= ipct + 1)
++		    pct = ipct + (ipct < pct);
++		}
++	    }
++
++	  if (0 <= pct)
++	    {
++	      if (asprintf (&cell, "%.0f%%", pct) == -1)
++		cell = NULL;
++	    }
++	  else
++	    cell = strdup ("-");
++
++	  if (!cell)
++	    xalloc_die ();
++
++	  break;
+ 
+         case FILE_FIELD:
+           cell = xstrdup (file);
+-- 
+1.8.4.1
+

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list