Bug 117648 - [patch] devel/a2dev fix building with GCC 4.2 + get rid of a few warnings
Summary: [patch] devel/a2dev fix building with GCC 4.2 + get rid of a few warnings
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Martin Wilke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-29 22:40 UTC by Pietro Cerutti
Modified: 2007-10-30 18:30 UTC (History)
0 users

See Also:


Attachments
file.diff (1.80 KB, patch)
2007-10-29 22:40 UTC, Pietro Cerutti
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pietro Cerutti 2007-10-29 22:40:01 UTC
devel/a2dev doesn't build with GCC 4.2 because of a cast expression used as an lvalue. Moreover, there a are a few warnings which are easily fixed (missing includes, ..)

Fix: add the following patch as files/path-ai
How-To-Repeat: cd /usr/ports/devel/a2dev && make
Comment 1 Pietro Cerutti 2007-10-29 23:03:11 UTC
Errata corrige: the previous patch didn't include ${WRCSRC} in the the
path of the files to be patched.


--- a2dev-1.2/util/error.c.orig	1995-03-26 05:48:05.000000000 +0200
+++ a2dev-1.2/util/error.c	2007-10-29 23:56:26.000000000 +0100
@@ -7,6 +7,7 @@
  */

 #include <stdio.h>
+#include <stdlib.h>
 #include <stdarg.h>
 #include "util.h"
 #include "error.h"
--- a2dev-1.2/util/hash.c.orig	1995-03-26 05:48:05.000000000 +0200
+++ a2dev-1.2/util/hash.c	2007-10-29 23:56:26.000000000 +0100
@@ -28,9 +28,13 @@
 Hash(void *bytes, unsigned length)
 {
 	unsigned	crc = CRC_INIT;
+   unsigned char byte;
+   unsigned len = 0;

-	while (length--)
-		crc = table[(crc ^ *((unsigned char *) bytes)++) & 0xFF] ^ (crc >> 8);
+   for(len=0; len<length; len++){
+      byte = ((unsigned char *)bytes)[len];
+		crc = table[(crc ^ byte) & 0xFF] ^ (crc >> 8);
+   }
 	return(crc ^ CRC_FINAL);
 }

--- a2dev-1.2/util/names.c.orig	1995-03-26 05:48:05.000000000 +0200
+++ a2dev-1.2/util/names.c	2007-10-29 23:56:26.000000000 +0100
@@ -6,6 +6,7 @@
  */

 #include <stdio.h>
+#include <string.h>
 #include "util.h"
 #include "error.h"
 #include "hash.h"
--- a2dev-1.2/asm/emit.c.orig	1995-03-28 07:15:14.000000000 +0200
+++ a2dev-1.2/asm/emit.c	2007-10-29 23:56:26.000000000 +0100
@@ -191,7 +191,7 @@

 /* Try to do zero page */

-	if (zmode >= 0 && CheckOp(ins, zmode) >= 0)
+	if (zmode >= 0 && CheckOp(ins, zmode) >= 0) {
 		if (ivalue->type == iSegRel
 				&& ivalue->u.segrel.segment == AbsSegment
 				&& (ivalue->u.segrel.offset & ~0xFF) == 0)
@@ -207,6 +207,7 @@
 			EmitIvalue(ivalue, FALSE, 0x01);
 			return;
 		}
+   }

 /* Can we ONLY do zero page (but didn't)? */

@@ -239,7 +240,7 @@

 /* Compute displacement to target address */

-	if (gPass == 2)
+	if (gPass == 2) {
 		if (ivalue->type != iSegRel || ivalue->u.segrel.segment != gSegment)
 			uerror("illegal branch address");
 		else
@@ -248,6 +249,7 @@
 			if (disp < -128 || disp > 127)
 				uerror("branch of %d bytes is out of range", disp);
 		}
+   }

 /* Done */



-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp
Comment 2 Martin Wilke freebsd_committer freebsd_triage 2007-10-29 23:37:41 UTC
Responsible Changed
From-To: freebsd-ports-bugs->miwi

I'll take it.
Comment 3 pietro.cerutti 2007-10-30 00:19:45 UTC
While I'm at it, I'd like to add the following:
this ports uses PATCH_STRIP, which in my view is senseless.

The following fixes that and a "BROKEN should not be quoted" minor issue
in Makefile.

diff -ruN a2dev.orig/Makefile a2dev/Makefile
--- a2dev.orig/Makefile	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/Makefile	2007-10-30 01:16:44.000000000 +0100
@@ -17,13 +17,13 @@
 COMMENT=		Apple II 6502 assembler, linker, loader, and object file viewer

 USE_GMAKE=		defined
-PATCH_STRIP=		-p1
+
 MAN1=			a2asm.1 a2link.1 a2load.1 a2objx.1

 .include <bsd.port.pre.mk>

 .if ${ARCH} != "i386"
-BROKEN=			"Does not compile on !i386"
+BROKEN=			Does not compile on !i386
 .endif

 .if ${OSVERSION} >= 700042
diff -ruN a2dev.orig/files/patch-aa a2dev/files/patch-aa
--- a2dev.orig/files/patch-aa	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-aa	2007-10-30 01:12:27.000000000 +0100
@@ -1,6 +1,6 @@
 diff -ur a2dev-1.2.orig/Make.defs a2dev-1.2/Make.defs
---- a2dev-1.2.orig/Make.defs	Tue Mar 28 07:14:43 1995
-+++ a2dev-1.2/Make.defs	Wed Jul  1 18:22:36 1998
+--- Make.defs	Tue Mar 28 07:14:43 1995
++++ Make.defs	Wed Jul  1 18:22:36 1998
 @@ -7,8 +7,8 @@

  # Where are installation "bin" and "man" subdirectories?
diff -ruN a2dev.orig/files/patch-ab a2dev/files/patch-ab
--- a2dev.orig/files/patch-ab	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ab	2007-10-30 01:12:27.000000000 +0100
@@ -1,6 +1,6 @@
 diff -ur a2dev-1.2.orig/Makefile a2dev-1.2/Makefile
---- a2dev-1.2.orig/Makefile	Sun Mar 26 06:08:22 1995
-+++ a2dev-1.2/Makefile	Wed Jul  1 18:27:21 1998
+--- Makefile	Sun Mar 26 06:08:22 1995
++++ Makefile	Wed Jul  1 18:27:21 1998
 @@ -13,7 +13,7 @@

  include		Make.defs
diff -ruN a2dev.orig/files/patch-ac a2dev/files/patch-ac
--- a2dev.orig/files/patch-ac	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ac	2007-10-30 01:12:27.000000000 +0100
@@ -1,5 +1,5 @@
---- a2dev-1.2/asm/Makefile.orig	Sat Mar 25 21:52:23 1995
-+++ a2dev-1.2/asm/Makefile	Tue Oct 13 21:25:02 1998
+--- asm/Makefile.orig	Sat Mar 25 21:52:23 1995
++++ asm/Makefile	Tue Oct 13 21:25:02 1998
 @@ -25,15 +25,15 @@
  ### Abstract rules
  ###
diff -ruN a2dev.orig/files/patch-ad a2dev/files/patch-ad
--- a2dev.orig/files/patch-ad	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ad	2007-10-30 01:12:27.000000000 +0100
@@ -1,5 +1,5 @@
---- a2dev-1.2/link/Makefile.orig	Sat Mar 25 21:52:45 1995
-+++ a2dev-1.2/link/Makefile	Tue Oct 13 21:28:09 1998
+--- link/Makefile.orig	Sat Mar 25 21:52:45 1995
++++ link/Makefile	Tue Oct 13 21:28:09 1998
 @@ -16,15 +16,15 @@
  ### Abstract rules
  ###
diff -ruN a2dev.orig/files/patch-ae a2dev/files/patch-ae
--- a2dev.orig/files/patch-ae	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ae	2007-10-30 01:12:27.000000000 +0100
@@ -1,5 +1,5 @@
---- a2dev-1.2/load/Makefile.orig	Sat Mar 25 21:52:37 1995
-+++ a2dev-1.2/load/Makefile	Tue Oct 13 21:29:06 1998
+--- load/Makefile.orig	Sat Mar 25 21:52:37 1995
++++ load/Makefile	Tue Oct 13 21:29:06 1998
 @@ -16,15 +16,15 @@
  ### Abstract rules
  ###
diff -ruN a2dev.orig/files/patch-af a2dev/files/patch-af
--- a2dev.orig/files/patch-af	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-af	2007-10-30 01:12:27.000000000 +0100
@@ -1,5 +1,5 @@
---- a2dev-1.2/objx/Makefile.orig	Sat Mar 25 21:52:54 1995
-+++ a2dev-1.2/objx/Makefile	Tue Oct 13 21:29:51 1998
+--- objx/Makefile.orig	Sat Mar 25 21:52:54 1995
++++ objx/Makefile	Tue Oct 13 21:29:51 1998
 @@ -16,15 +16,15 @@
  ### Abstract rules
  ###
diff -ruN a2dev.orig/files/patch-ag a2dev/files/patch-ag
--- a2dev.orig/files/patch-ag	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ag	2007-10-30 01:12:27.000000000 +0100
@@ -1,6 +1,5 @@
-diff -ur a2dev-1.2.orig/test/Makefile a2dev-1.2/test/Makefile
---- a2dev-1.2.orig/test/Makefile	Mon Mar 27 22:16:25 1995
-+++ a2dev-1.2/test/Makefile	Wed Jul  1 18:34:39 1998
+--- test/Makefile	Mon Mar 27 22:16:25 1995
++++ test/Makefile	Wed Jul  1 18:34:39 1998
 @@ -11,11 +11,12 @@
  ### Default is to do nothing -- "make verify" runs the test.
  ###
diff -ruN a2dev.orig/files/patch-ah a2dev/files/patch-ah
--- a2dev.orig/files/patch-ah	2007-10-30 01:12:27.000000000 +0100
+++ a2dev/files/patch-ah	2007-10-30 01:12:27.000000000 +0100
@@ -1,6 +1,5 @@
-diff -ur a2dev-1.2.orig/util/Makefile a2dev-1.2/util/Makefile
---- a2dev-1.2.orig/util/Makefile	Wed Mar 22 19:05:32 1995
-+++ a2dev-1.2/util/Makefile	Wed Jul  1 18:41:55 1998
+--- util/Makefile	Wed Mar 22 19:05:32 1995
++++ util/Makefile	Wed Jul  1 18:41:55 1998
 @@ -9,14 +9,15 @@

  UTIL		:= util.a
diff -ruN a2dev.orig/files/patch-ai a2dev/files/patch-ai
--- a2dev.orig/files/patch-ai	2007-10-30 01:15:16.000000000 +0100
+++ a2dev/files/patch-ai	2007-10-30 01:05:23.000000000 +0100
@@ -1,5 +1,5 @@
---- a2dev-1.2/util/error.c.orig	2007-10-29 23:28:26.000000000 +0100
-+++ a2dev-1.2/util/error.c	2007-10-29 23:29:40.000000000 +0100
+--- util/error.c.orig	2007-10-29 23:28:26.000000000 +0100
++++ util/error.c	2007-10-29 23:29:40.000000000 +0100
 @@ -7,6 +7,7 @@
   */

@@ -8,8 +8,8 @@
  #include <stdarg.h>
  #include "util.h"
  #include "error.h"
---- a2dev-1.2/util/hash.c.orig	2007-10-29 23:27:57.000000000 +0100
-+++ a2dev-1.2/util/hash.c	2007-10-29 23:29:40.000000000 +0100
+--- util/hash.c.orig	2007-10-29 23:27:57.000000000 +0100
++++ util/hash.c	2007-10-29 23:29:40.000000000 +0100
 @@ -28,9 +28,13 @@
  Hash(void *bytes, unsigned length)
  {
@@ -26,8 +26,8 @@
  	return(crc ^ CRC_FINAL);
  }

---- a2dev-1.2/util/names.c.orig	2007-10-29 23:28:43.000000000 +0100
-+++ a2dev-1.2/util/names.c	2007-10-29 23:29:40.000000000 +0100
+--- util/names.c.orig	2007-10-29 23:28:43.000000000 +0100
++++ util/names.c	2007-10-29 23:29:40.000000000 +0100
 @@ -6,6 +6,7 @@
   */

@@ -36,8 +36,8 @@
  #include "util.h"
  #include "error.h"
  #include "hash.h"
---- a2dev-1.2/asm/emit.c.orig	2007-10-29 23:28:20.000000000 +0100
-+++ a2dev-1.2/asm/emit.c	2007-10-29 23:29:44.000000000 +0100
+--- asm/emit.c.orig	2007-10-29 23:28:20.000000000 +0100
++++ asm/emit.c	2007-10-29 23:29:44.000000000 +0100
 @@ -191,7 +191,7 @@

  /* Try to do zero page */



-- 
Ing. Pietro Cerutti

Bachelor of Science in Computer Science
Specialisation in Software Engineering

Bern University of Applied Sciences
Engineering and Information Technology
[ www.ti.bfh.ch ]
Comment 4 Martin Wilke freebsd_committer freebsd_triage 2007-10-30 10:54:21 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!
Comment 5 dfilter service freebsd_committer freebsd_triage 2007-10-30 18:23:34 UTC
miwi        2007-10-30 10:54:00 UTC

  FreeBSD ports repository

  Modified files:
    devel/a2dev          Makefile 
    devel/a2dev/files    patch-aa patch-ab patch-ac patch-ad 
                         patch-ae patch-af patch-ag patch-ah 
  Added files:
    devel/a2dev/files    patch-asm_emit.c patch-util_error.c 
                         patch-util_hash.c patch-util_names.c 
  Removed files:
    devel/a2dev          pkg-plist 
  Log:
  - Unbreak
  - Fix build with gcc 4.2
  - pet portlint
  
  PR:             117648 (based on)
  Submitted by:   Pietro Cerutti <gahr@gahr.ch>
  
  Revision  Changes    Path
  1.15      +13 -16    ports/devel/a2dev/Makefile
  1.2       +2 -2      ports/devel/a2dev/files/patch-aa
  1.2       +2 -2      ports/devel/a2dev/files/patch-ab
  1.3       +2 -2      ports/devel/a2dev/files/patch-ac
  1.3       +2 -2      ports/devel/a2dev/files/patch-ad
  1.3       +2 -2      ports/devel/a2dev/files/patch-ae
  1.3       +2 -2      ports/devel/a2dev/files/patch-af
  1.2       +2 -3      ports/devel/a2dev/files/patch-ag
  1.2       +2 -3      ports/devel/a2dev/files/patch-ah
  1.1       +38 -0     ports/devel/a2dev/files/patch-asm_emit.c (new)
  1.1       +10 -0     ports/devel/a2dev/files/patch-util_error.c (new)
  1.1       +17 -0     ports/devel/a2dev/files/patch-util_hash.c (new)
  1.1       +10 -0     ports/devel/a2dev/files/patch-util_names.c (new)
  1.3       +0 -4      ports/devel/a2dev/pkg-plist (dead)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"