--- Begin Message ---
Subject: |
coreutils 8.10 portability fixes |
Date: |
Sat, 19 Mar 2011 12:04:46 -0700 |
Two sets of fixes:
- Several places where iterator variables are declared inside for(), failing
compiles
on systems that support c99.
- The inclusion of <langinfo.h> has to be protected by
#if HAVE_NL_LANGINFO
instead of
#if HAVE_LANGINFO_CODESET
to match the piece of code later where the langinfo is actually used.
These problems surfaced when building on an old IRIX5.3 system with gcc 3.4.6.
--Andreas
*** src/csplit.c.dist Mon Jan 31 04:40:38 2011
--- src/csplit.c Thu Mar 17 20:07:05 2011
***************
*** 1200,1207 ****
get_format_flags (char const *format, int *flags_ptr)
{
int flags = 0;
! for (size_t count = 0; ; count++)
{
switch (format[count])
{
--- 1200,1208 ----
get_format_flags (char const *format, int *flags_ptr)
{
int flags = 0;
+ size_t count;
! for (count = 0; ; count++)
{
switch (format[count])
{
***************
*** 1275,1282 ****
max_out (char *format)
{
bool percent = false;
! for (char *f = format; *f; f++)
if (*f == '%' && *++f != '%')
{
if (percent)
--- 1276,1284 ----
max_out (char *format)
{
bool percent = false;
+ char *f;
! for (f = format; *f; f++)
if (*f == '%' && *++f != '%')
{
if (percent)
*** src/ls.c.dist Mon Jan 31 04:40:38 2011
--- src/ls.c Thu Mar 17 20:12:24 2011
***************
*** 60,66 ****
#include <selinux/selinux.h>
#include <wchar.h>
! #if HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
--- 60,66 ----
#include <selinux/selinux.h>
#include <wchar.h>
! #if HAVE_NL_LANGINFO
# include <langinfo.h>
#endif
***************
*** 1036,1044 ****
size_t curr_max_width;
do
{
curr_max_width = required_mon_width;
required_mon_width = 0;
! for (int i = 0; i < 12; i++)
{
size_t width = curr_max_width;
--- 1036,1045 ----
size_t curr_max_width;
do
{
+ int i;
curr_max_width = required_mon_width;
required_mon_width = 0;
! for (i = 0; i < 12; i++)
{
size_t width = curr_max_width;
*** src/sort.c.dist Thu Feb 3 02:24:35 2011
--- src/sort.c Thu Mar 17 20:23:49 2011
***************
*** 67,73 ****
proper_name ("Mike Haertel"), \
proper_name ("Paul Eggert")
! #if HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
--- 67,73 ----
proper_name ("Mike Haertel"), \
proper_name ("Paul Eggert")
! #if HAVE_NL_LANGINFO
# include <langinfo.h>
#endif
*** src/stat.c.dist Mon Jan 31 04:40:38 2011
--- src/stat.c Thu Mar 17 20:53:00 2011
***************
*** 586,592 ****
if (1 < w)
{
char *dst = pformat;
! for (char const *src = dst; src < p; src++)
{
if (*src == '-')
frac_left_adjust = true;
--- 586,593 ----
if (1 < w)
{
char *dst = pformat;
! char const *src;
! for (src = dst; src < p; src++)
{
if (*src == '-')
frac_left_adjust = true;
***************
*** 603,609 ****
}
int divisor = 1;
! for (int i = precision; i < 9; i++)
divisor *= 10;
int frac_sec = arg.tv_nsec / divisor;
int int_len;
--- 604,611 ----
}
int divisor = 1;
! int i;
! for (i = precision; i < 9; i++)
divisor *= 10;
int frac_sec = arg.tv_nsec / divisor;
int int_len;
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#8295: coreutils 8.10 portability fixes |
Date: |
Tue, 8 Apr 2014 11:29:28 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Jim Meyering wrote:
> tags 8295 moreinfo
> tags 8295 notabug
> thanks
>
> Andreas Stolcke wrote:
> > In message you wrote:
> >> On 03/19/2011 12:04 PM, Andreas Stolcke wrote:
> >> > - Several places where iterator variables are declared inside
> >> > for(), failing compiles
> >> > on systems that support c99.
> >>
> >> I assume you meant "systems that don't support c99".
> >
> > right.
> >
> >> The README file has a section "Pre-C99 build failure"
> >> about that. Which compiler were you using, and why
> >> didn't "configure" successfully put it into c99 mode?
> >
> > gcc-3.4.6 on mips-sgi-irix5.3, the last version i was able build on this
> > old box.
> > Good question, i don't know why configure didn't add -std=c99 to the CFLAGS.
> > That would be the easier fix.
>
> I've marked this as notabug for now, presuming the probmem is due
> to your compiler. Please let us know if you learn otherwise.
Several years have passed and also several coreutils releases.
Nothing additional has been heard to this bug log concerning this in
that time. Assuming that all is good and resolved. Closing this bug
in the bug tracker.
Bob
--- End Message ---