www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/26/16:06:45

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C02AE90.EDB68A46@phekda.freeserve.co.uk>
Date: Mon, 26 Nov 2001 21:05:20 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: RESEND: Patch to computer st_blksize in struct stat
References: <200111182235 DOT XAA21129 AT father DOT ludd DOT luth DOT se> <3BF976C8 DOT 9048342 AT phekda DOT freeserve DOT co DOT uk> <9003-Tue20Nov2001084418+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> Richard Dawe wrote:
> >
> > Unix98 specifies that st_blksize should be a blksize_t not an off_t.
> > Does anyone object to this change? Will it break source compatibility?
> 
> It shouldn't break source compatibility, but with today's picky
> defaults for GCC warnings you can never know.  I think it's best to
> write a short test program and see whether it compiles.

I compiled the following program with -Wall -g against:

* DJGPP 2.03 with -Wall -g,
* DJGPP CVS with my blksize_t patch and -DWE_HAVE_BLKSIZE_T.

No warnings or errors were generated using gcc 3.0.2 (NB: not the latest
patched release of gcc 3.0.2). Please let me know if I've missed out any
tests for source compatibility (I couldn't think of any more).

Thanks, bye, Rich =]

-- 
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

int
main (void)
{
  struct stat s;
  off_t foo = 123;
  off_t *po = NULL;
#ifdef WE_HAVE_BLKSIZE_T
  blksize_t bar = 456;
  blksize_t *pb = NULL;
#endif
  int i = 789;
  int *pi = NULL;

  memset(&s, 0, sizeof(s));
  s.st_blksize = foo;
  s.st_blksize = i;

#ifdef WE_HAVE_BLKSIZE_T
  printf("foo was %d\n", foo);
  foo = bar;
  printf("foo is now %d\n", foo);

  printf("i was %d\n", i);
  i = bar;
  printf("i is now %d\n", i);

  pb = &i;
  pb = &foo;
  pi = &bar;
  po = &bar;
#endif

  pi = &foo;
  po = &i;

  return(EXIT_SUCCESS);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019