Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Oct 2007 22:04:02 GMT
From:      "gahr@gahr.ch" <Pietro.Cerutti@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/117691: [patch] audio/nosefart fix build with gcc 4.2
Message-ID:  <200710302204.l9UM420Z075648@www.freebsd.org>
Resent-Message-ID: <200710302210.l9UMA1mQ007418@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         117691
>Category:       ports
>Synopsis:       [patch] audio/nosefart fix build with gcc 4.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 30 22:10:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     gahr@gahr.ch
>Release:        6.2-STABLE
>Organization:
Bern University of Applied Sciences
>Environment:
FreeBSD gahrtop.localhost 6.2-STABLE FreeBSD 6.2-STABLE #3: Wed Oct 24 08:30:39 CEST 2007     root@gahrtop.localhost:/usr/obj/usr/src/sys/MSI1034  i386
>Description:
audio/nosefart fails to build with gcc 4.2 because of a cast used where an lvalue is required
>How-To-Repeat:
cd /usr/ports/audio/nosefart && make
>Fix:
The following patch removes the BROKEN message from the port's Makefile and adds a patch to files/patch-src-sndhrdw-nes_apu.c which fixes the actual lvalue problem.


diff -ruN nosefart.orig/Makefile nosefart/Makefile
--- nosefart.orig/Makefile      2007-10-02 11:17:16.000000000 +0200
+++ nosefart/Makefile   2007-10-30 22:58:40.000000000 +0100
@@ -27,10 +27,4 @@
 pre-build:
        @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} clean)
 
-.include    <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 700042
-BROKEN=                Does not compile with GCC 4.2
-.endif
-
-.include    <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -ruN nosefart.orig/files/patch-src-sndhrdw-nes_apu.c nosefart/files/patch-src-sndhrdw-nes_apu.c
--- nosefart.orig/files/patch-src-sndhrdw-nes_apu.c     1970-01-01 01:00:00.000000000 +0100
+++ nosefart/files/patch-src-sndhrdw-nes_apu.c  2007-10-30 22:58:40.000000000 +0100
@@ -0,0 +1,25 @@
+--- src/sndhrdw/nes_apu.c.orig 2007-10-30 22:51:03.000000000 +0100
++++ src/sndhrdw/nes_apu.c      2007-10-30 22:52:28.000000000 +0100
+@@ -980,6 +980,9 @@
+    uint32 elapsed_cycles;
+    static int32 prev_sample = 0;
+    int32 next_sample, accum;
++   uint8 *buff_u8 = (uint8 *)buffer;
++   int16 *buff_16 = (int16 *)buffer;
++
+ 
+    ASSERT(apu);
+ 
+@@ -1035,9 +1038,9 @@
+ 
+       /* signed 16-bit output, unsigned 8-bit */
+       if (16 == apu->sample_bits)
+-         *((int16 *) buffer)++ = (int16) accum;
+-      else
+-         *((uint8 *) buffer)++ = (accum >> 8) ^ 0x80;
++         *buff_16++ = (int16) accum;
++      else 
++         *buff_u8++ = (accum >> 8) ^0x80;
+    }
+ 
+    /* resync cycle counter */

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710302204.l9UM420Z075648>