How about this patch?

--- librestrict/xstatconv.c.org 2014-10-19 09:52:52.951262300 +0900
+++ librestrict/xstatconv.c     2014-11-01 20:26:35.734854500 +0900
@@ -48,20 +48,16 @@
       {
        struct stat *buf = ubuf;
 
+       /* zero clear */
+       memset(buf, 0, sizeof(*buf));
        /* Convert to current kernel version of `struct stat'.  */
        buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT___PAD1
-       buf->__pad1 = 0;
-#endif
        buf->st_ino = kbuf->st_ino;
        buf->st_mode = kbuf->st_mode;
        buf->st_nlink = kbuf->st_nlink;
        buf->st_uid = kbuf->st_uid;
        buf->st_gid = kbuf->st_gid;
        buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT___PAD2
-       buf->__pad2 = 0;
-#endif
        buf->st_size = kbuf->st_size;
        buf->st_blksize = kbuf->st_blksize;
        buf->st_blocks = kbuf->st_blocks;
@@ -77,21 +73,6 @@
        buf->st_mtime = kbuf->st_mtime;
        buf->st_ctime = kbuf->st_ctime;
 #endif
-#ifdef _HAVE_STAT___UNUSED1
-       buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED2
-       buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED3
-       buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED4
-       buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED5
-       buf->__unused5 = 0;
-#endif
       }
       break;
 
@@ -116,11 +97,10 @@
       {
        struct stat64 *buf = ubuf;
 
+       /* zero clear */
+       memset(buf, 0, sizeof(*buf));
        /* Convert to current kernel version of `struct stat64'.  */
        buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT64___PAD1
-       buf->__pad1 = 0;
-#endif
        buf->st_ino = kbuf->st_ino;
 #ifdef _HAVE_STAT64___ST_INO
        buf->__st_ino = kbuf->st_ino;
@@ -130,9 +110,6 @@
        buf->st_uid = kbuf->st_uid;
        buf->st_gid = kbuf->st_gid;
        buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT64___PAD2
-       buf->__pad2 = 0;
-#endif
        buf->st_size = kbuf->st_size;
        buf->st_blksize = kbuf->st_blksize;
        buf->st_blocks = kbuf->st_blocks;
@@ -148,21 +125,6 @@
        buf->st_mtime = kbuf->st_mtime;
        buf->st_ctime = kbuf->st_ctime;
 #endif
-#ifdef _HAVE_STAT64___UNUSED1
-       buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED2
-       buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED3
-       buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED4
-       buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT64___UNUSED5
-       buf->__unused5 = 0;
-#endif
       }
       break;
 
@@ -185,12 +147,11 @@
     {
     case _STAT_VER_LINUX:
       {
+       /* zero clear */
+       memset(buf, 0, sizeof(*buf));
        /* Convert current kernel version of `struct stat64' to
            `struct stat'.  */
        buf->st_dev = kbuf->st_dev;
-#ifdef _HAVE_STAT___PAD1
-       buf->__pad1 = 0;
-#endif
 #ifdef _HAVE_STAT64___ST_INO
 # if __ASSUME_ST_INO_64_BIT == 0
        if (kbuf->st_ino == 0)
@@ -220,9 +181,6 @@
        buf->st_uid = kbuf->st_uid;
        buf->st_gid = kbuf->st_gid;
        buf->st_rdev = kbuf->st_rdev;
-#ifdef _HAVE_STAT___PAD2
-       buf->__pad2 = 0;
-#endif
        buf->st_size = kbuf->st_size;
        /* Check for overflow.  */
        if (sizeof (buf->st_size) != sizeof (kbuf->st_size)
@@ -253,21 +211,6 @@
        buf->st_ctime = kbuf->st_ctime;
 #endif
 
-#ifdef _HAVE_STAT___UNUSED1
-       buf->__unused1 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED2
-       buf->__unused2 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED3
-       buf->__unused3 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED4
-       buf->__unused4 = 0;
-#endif
-#ifdef _HAVE_STAT___UNUSED5
-       buf->__unused5 = 0;
-#endif
       }
       break;
 


> I get:
> 
> ~/gub/target/tools/build/librestrict-1.9.a$ gcc -W -Wall
> -fno-stack-protector -I. -fPIC -shared -o librestrict-stat.so
> restrict-stat.c
> In file included from restrict-stat.c:106:0:
> ./xstatconv.c: In function ‘__xstat_conv’:
> ./xstatconv.c:90:5: error: ‘struct stat’ has no member named
> ‘__unused4’
> buf->__unused4 = 0;
> ^
> ./xstatconv.c:93:5: error: ‘struct stat’ has no member named
> ‘__unused5’
> buf->__unused5 = 0;
> ^
> ./xstatconv.c: In function ‘__xstat32_conv’:
> ./xstatconv.c:266:5: error: ‘struct stat’ has no member named
> ‘__unused4’
> buf->__unused4 = 0;
> ^
> ./xstatconv.c:269:5: error: ‘struct stat’ has no member named
> ‘__unused5’
> buf->__unused5 = 0;
> ^
> 
> 
> --
> Phil Holmes
> 
> 
> ----- Original Message ----- 
> From: "Jan Nieuwenhuizen" <jann...@gnu.org>
> To: "Phil Holmes" <m...@philholmes.net>
> Cc: "David Kastrup" <d...@gnu.org>; "Federico Bruni"
> <fedel...@gmail.com>; <lilypond-devel@gnu.org>
> Sent: Tuesday, October 28, 2014 12:58 PM
> Subject: Re: GUB and mpfr/mpc
> 
> 
> Phil Holmes writes:
> 
> If there's nothing in the log file, you'll have to investigate by
> hand.
> Go to the build directory and see
> 
>    cd /home/gub/gub/target/tools/build/librestrict-1.9.a
>    gcc -W -Wall -fno-stack-protector -I. -fPIC -shared -o
>    librestrict-stat.so restrict-stat.c
> 
> (eg, doing gcc -vvv or cpp -E or somesuch) why it fails to compile.
> It's a simple c file with local includes; weird.
> 
> Greetings,
> Jan
> 
>> I get:
>>
>> calculating dependencies
>> Checking for gcc ... /usr/bin/gcc
>> must rebuild[tools]: system::gcc librestrict make libtool file tar m4
>> perl autoconf patch zlib
>> building package: tools::librestrict
>> *** Stage: download (librestrict, tools)
>> *** Stage: untar (librestrict, tools)
>> *** Stage: patch (librestrict, tools)
>> *** Stage: shadow (librestrict, tools)
>> *** Stage: compile (librestrict, tools)
>> Command barfed: cd /home/gub/gub/target/tools/build/librestrict-1.9.a
>> && gcc -W -Wall -fno-stack-protector -I. -fPIC -shared -o
>> librestrict-stat.so restrict-stat.c || gcc -W -Wall -I. -fPIC -shared
>> -o librestrict-stat.so restrict-stat.c
>>
>> Tail of target/tools/log/librestrict.log >>>>>>>>
>> ./xstatconv.c:269:5: error: 'struct stat' has no member named
>> '__unused5'
>> buf->__unused5 = 0;
>> ^
>> Command barfed: cd /home/gub/gub/target/tools/build/librestrict-1.9.a
>> && gcc -W -Wall -fno-stack-protector -I. -fPIC -shared -o
>> librestrict-stat.so restrict-stat.c || gcc -W -Wall -I. -fPIC -shared
>> -o librestrict-stat.so restrict-stat.c
>> <<<<<<<< Tail of target/tools/log/librestrict.log
>>
>> *** Failed target: tools::librestrict
>>
>>
>> --
>> Phil Holmes
>>
>>
>> ----- Original Message ----- 
>> From: "Jan Nieuwenhuizen" <jann...@gnu.org>
>> To: "Phil Holmes" <m...@philholmes.net>
>> Cc: "David Kastrup" <d...@gnu.org>; "Federico Bruni"
>> <fedel...@gmail.com>; <lilypond-devel@gnu.org>
>> Sent: Tuesday, October 28, 2014 10:45 AM
>> Subject: Re: GUB and mpfr/mpc
>>
>>
>> Phil Holmes writes:
>>
>>> https://github.com/gperciva/gub
>>
>> I don't think librestrict has changed in years, works for me [on
>> 14.10].
>>
>> Jan
>>
>> $ ./bin/gub tools::librestrict
>> calculating dependencies
>> Checking for gcc ... /usr/bin/gcc
>> must rebuild[tools]: system::gcc librestrict make libtool file tar m4
>> perl autoconf patch zlib
>> Checking for gcc ... (cached) /usr/bin/gcc
>> building package: system::gcc
>> *** Stage: download (gcc, system)
>> *** Stage: configure (gcc, system)
>> Checking for gcc ... (cached) /usr/bin/gcc
>>
>> building package: tools::librestrict
>> *** Stage: download (librestrict, tools)
>> *** Stage: untar (librestrict, tools)
>> *** Stage: patch (librestrict, tools)
>> *** Stage: shadow (librestrict, tools)
>> *** Stage: compile (librestrict, tools)
>> *** Stage: install (librestrict, tools)
>> *** Stage: package (librestrict, tools)
>> *** Stage: clean (librestrict, tools)
>> *** Stage: pkg_install (librestrict, tools)
>>
>> [...]
> 
> -- 
> Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org
> Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.nl
> 
> 
> _______________________________________________
> lilypond-devel mailing list
> lilypond-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-devel
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to