Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jun 2011 22:18:41 GMT
From:      Marcin Cieslak <saper@saper.info>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        alexis@m2osw.com
Subject:   ports/158077: [PATCH] graphics/sswf: update to allow compilation with clang
Message-ID:  <201106202218.p5KMIfFq074921@radziecki.saper.info>
Resent-Message-ID: <201106202220.p5KMK5ju024502@freefall.freebsd.org>

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

>Number:         158077
>Category:       ports
>Synopsis:       [PATCH] graphics/sswf: update to allow compilation with clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 20 22:20:05 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Marcin Cieslak <saper@saper.info>
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
http://saper.info
>Environment:
System: FreeBSD radziecki.saper.info 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r219785M: Mon Mar 21 11:40:40 CET
>Description:

Compilation of sswf fails with clang. The error message is:

libtool: compile:  /usr/bin/clang++ -DPACKAGE_NAME=\"ScriptSWF\" -DPACKAGE_TARNAME=\"sswf\" -DPACKAGE_VERSION=\"1.8.4\" "-DPACKAGE_STRING=\"ScriptSWF 1.8.4\"" -DPACKAGE_BUGREPORT=\"alexis@m2osw.com\" -DPACKAGE=\"sswf\" -DVERSION=\"1.8.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_STDARG_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_ERRNO_H=1 -DHAVE_ZLIB_H=1 -DHAVE_MATH_H=1 -DHAVE_CTYPE_H=1 -DHAVE_ICONV_H=1 -I. -I. -I../../include -I/usr/local/include -O2 -pipe -fno-strict-aliasing -MT compile.lo -MD -MP -MF .deps/compile.Tpo -c compile.c++  -fPIC -DPIC -o .libs/compile.o
compile.c++:719:17: error: variable length array of non-POD element type 'sswf::as::NodePtr'
        NodePtr parents[count];
                       ^
1 error generated.

(as shown on http://pointyhat.freebsd.org/errorlogs/amd64-errorlogs/e.9-exp.20110616185105/sswf-1.8.4_2.log)

Also removes MD5 from the distinfo and removes CPPFLAGS as pointed out by portlint

Added file(s):
- files/patch-designators
- files/patch-extern
- files/patch-libas_compile.cpp

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:

Compile using clang instead of gcc

>Fix:

Full diff against port CVS at the end, plaintext patches follow:

Fix compilation error:

--- src/libas/compile.c++.orig	2011-06-20 23:06:36.000000000 +0200
+++ src/libas/compile.c++	2011-06-20 23:13:11.000000000 +0200
@@ -706,18 +706,7 @@
 	//	frames and then we search that array with each
 	//	parent of the label
 
-#ifdef _MSVC
-	// alloca() not available with cl
-	class AutoDelete {
-	public: AutoDelete(NodePtr *ptr) { f_ptr = ptr; }
-		~AutoDelete() { delete f_ptr; }
-	private: NodePtr *f_ptr;
-	};
 	NodePtr *parents = new NodePtr[count];
-	AutoDelete ad_parent(parents);
-#else
-	NodePtr parents[count];
-#endif
 	parent = goto_node;
 	for(idx = 0; idx < count; ++idx) {
 		parent = parent.GetParent();
@@ -731,16 +720,19 @@
 		parent = parent.GetParent();
 		if(!parent.HasNode()) {
 			f_error_stream->ErrMsg(AS_ERR_INTERNAL_ERROR, goto_node, "IntCompiler::Goto(): Out of parent before we find the common node?!");
+			delete parents;
 			AS_ASSERT(0);
 			return;
 		}
 		for(idx = 0; idx < count; ++idx) {
 			if(parents[idx].SameAs(parent)) {
 				goto_node.SetLink(NodePtr::LINK_GOTO_EXIT, parent);
+				delete parents;
 				return;
 			}
 		}
 	}
+	delete parents;
 }
 
------------------------------


Fix "GNU old style designator warnings":

--- src/sswf/sswf_node.c.orig	2009-03-08 05:04:03.000000000 +0100
+++ src/sswf/sswf_node.c	2011-06-20 23:57:15.000000000 +0200
@@ -2987,65 +2987,65 @@
 
 
 #ifndef _MSVC
-#define	DEF_PARAM(prm, value)		{ param: DEF_PARAM_##prm, { value } }
+#define	DEF_PARAM(prm, value)		{ .param = DEF_PARAM_##prm, { value } }
 
 #define	DEF_START(name)			const struct definition_t node_def_##name[] = {	\
-						DEF_PARAM(NAME, string: #name),
+						DEF_PARAM(NAME, .string = #name),
 
-#define	DEF_END()			DEF_PARAM(END, ignored: 0) };
-#define	DEF_LABEL(label)		DEF_PARAM(LABEL, string: label ),
-#define	DEF_NOLABEL()			DEF_PARAM(LABEL, string: NULL ),
-#define	DEF_REPEAT()			DEF_PARAM(REPEAT, ignored: 0),
-#define	DEF_EMPTY()			DEF_PARAM(EMPTY, ignored: 0),
+#define	DEF_END()			DEF_PARAM(END, .ignored = 0) };
+#define	DEF_LABEL(label)		DEF_PARAM(LABEL, .string = label ),
+#define	DEF_NOLABEL()			DEF_PARAM(LABEL, .string = NULL ),
+#define	DEF_REPEAT()			DEF_PARAM(REPEAT, .ignored = 0),
+#define	DEF_EMPTY()			DEF_PARAM(EMPTY, .ignored = 0),
 
 #define	DEF_OBJECT_REF()								\
-	DEF_PARAM(TYPE, type: NODE_TYPE_OBJECT),					\
-	DEF_PARAM(SUBTYPE, type: NODE_SUBTYPE_REFERENCE),
+	DEF_PARAM(TYPE, .type = NODE_TYPE_OBJECT),					\
+	DEF_PARAM(SUBTYPE, .type = NODE_SUBTYPE_REFERENCE),
 
 #define	DEF_OBJECT(sub_type)								\
-	DEF_PARAM(TYPE, type: NODE_TYPE_DATA),						\
-	DEF_PARAM(SUBTYPE, type: NODE_SUBTYPE_##sub_type),
+	DEF_PARAM(TYPE, .type = NODE_TYPE_DATA),						\
+	DEF_PARAM(SUBTYPE, .type = NODE_SUBTYPE_##sub_type),
 
 #define	DEF_OBJECT_OPT(sub_type)							\
 	DEF_OBJECT(sub_type)								\
-	DEF_PARAM(OPTIONAL, ignored: 0),
+	DEF_PARAM(OPTIONAL, .ignored = 0),
 
 #define	DEF_VALUE0(unit_nm, structure, end_t, field, defval)				\
-	DEF_PARAM(TYPE, type: NODE_TYPE_FLOAT),						\
-	DEF_PARAM(OFFSET, offset: offsetof(struct data_##structure##end_t, field)),	\
-	DEF_PARAM(UNIT, unit: NODE_UNIT_##unit_nm),					\
-	DEF_PARAM(DEFAULT, def_value: defval),
+	DEF_PARAM(TYPE, .type = NODE_TYPE_FLOAT),						\
+	DEF_PARAM(OFFSET, .offset = offsetof(struct data_##structure##end_t, field)),	\
+	DEF_PARAM(UNIT, .unit = NODE_UNIT_##unit_nm),					\
+	DEF_PARAM(DEFAULT, .def_value = defval),
 
 #define	DEF_VALUE(unit, structure, field, def_value)					\
 	DEF_VALUE0(unit, structure, _t, field, def_value)
 
 #define	DEF_VALUE_OPT(unit, structure, field, def_value)				\
 	DEF_VALUE0(unit, structure, _t, field, def_value)				\
-	DEF_PARAM(OPTIONAL, ignored: 0),
+	DEF_PARAM(OPTIONAL, .ignored = 0),
 
 #define	DEF_STRING()									\
-	DEF_PARAM(TYPE, type: NODE_TYPE_STRING),
+	DEF_PARAM(TYPE, .type = NODE_TYPE_STRING),
 
 #define	DEF_STRING_OPT()								\
-	DEF_PARAM(TYPE, type: NODE_TYPE_STRING),					\
-	DEF_PARAM(OPTIONAL, ignored: 0),
+	DEF_PARAM(TYPE, .type = NODE_TYPE_STRING),					\
+	DEF_PARAM(OPTIONAL, .ignored = 0),
 
 #define	DEF_SET0(structure, end_t, field, value)					\
-	DEF_PARAM(SET, set: value),							\
-	DEF_PARAM(OFFSET, offset: offsetof(struct data_##structure##end_t, field)),
+	DEF_PARAM(SET, .set = value),							\
+	DEF_PARAM(OFFSET, .offset = offsetof(struct data_##structure##end_t, field)),
 
 #define	DEF_SET(structure, field, value)						\
 	DEF_SET0(structure, _t, field, value)
 
 #define	DEF_SIZE0(structure, end_t)							\
-	DEF_PARAM(SIZE, size: sizeof(struct data_##structure##end_t)),
+	DEF_PARAM(SIZE, .size =  sizeof(struct data_##structure##end_t)),
 
 #define	DEF_SIZE(structure)								\
 	DEF_SIZE0(structure, _t)
 
 /*
 #define	DEF_SEPARATOR()									\
-	DEF_PARAM(SEPARATOR, ignored: 0),
+	DEF_PARAM(SEPARATOR, .ignored = 0),
 */
 #else
 
@@ -3111,7 +3111,7 @@
 
 #define	DEF_START(name)				DEF_PARAM(string, node_def_##name, NAME, #name)
 
-//const struct definition_t node_def_##name[] = { DEF_PARAM(NAME, string: #name),
+//const struct definition_t node_def_##name[] = { DEF_PARAM(NAME, .string = #name),
 
 #define	DEF_END()			DEF_PARAM_IGNORE(END)
 #define	DEF_LABEL(label)		DEF_PARAM_AN(string, LABEL, label)
@@ -3166,7 +3166,7 @@
 
 /*
 #define	DEF_SEPARATOR()									\
-	DEF_PARAM(SEPARATOR, ignored: 0),
+	DEF_PARAM(SEPARATOR, .ignored = 0),
 */
 #endif
--------------------------------------


Small patch to fixed warnings about initialized extern:

--- src/libasc/asc_strings.c++.orig	2011-06-21 00:02:53.000000000 +0200
+++ src/libasc/asc_strings.c++	2011-06-21 00:03:42.000000000 +0200
@@ -4009,8 +4009,8 @@
 ;
 }
 
-extern const int files_count = 46;
-extern const char *files[] = {
+const int files_count = 46;
+const char *files[] = {
 	"include/sswf/scripts/extensions/trace.asc", file1,
 	"include/sswf/scripts/extensions/complex.asc", file2,
 	"include/sswf/scripts/global/extensions.asc", file3,
--------------------------------------


--- sswf-1.8.4_2.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/graphics/sswf.orig/Makefile /usr/ports/graphics/sswf/Makefile
--- /usr/ports/graphics/sswf.orig/Makefile	2010-12-04 08:32:11.000000000 +0100
+++ /usr/ports/graphics/sswf/Makefile	2011-06-21 00:10:31.000000000 +0200
@@ -24,7 +24,7 @@
 USE_BISON=	build
 USE_ICONV=	yes
 USE_AUTOTOOLS=	libtool
-CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
+CONFIGURE_ENV=	LDFLAGS="${LDFLAGS}"
 CONFIGURE_ARGS=	--with-pkgconfigdir=${PREFIX}/libdata/pkgconfig
 USE_LDCONFIG=	yes
 
diff -ruN --exclude=CVS /usr/ports/graphics/sswf.orig/distinfo /usr/ports/graphics/sswf/distinfo
--- /usr/ports/graphics/sswf.orig/distinfo	2009-03-21 00:31:14.000000000 +0100
+++ /usr/ports/graphics/sswf/distinfo	2011-06-21 00:10:51.000000000 +0200
@@ -1,3 +1,2 @@
-MD5 (sswf-1.8.4-src.tar.gz) = cc39009d83efd3499cd31ca48702574b
 SHA256 (sswf-1.8.4-src.tar.gz) = 45b6335b1892e834e81bc4870962c7c6bed0a03261c6246ccdc5215f70339a8b
 SIZE (sswf-1.8.4-src.tar.gz) = 3491002
diff -ruN --exclude=CVS /usr/ports/graphics/sswf.orig/files/patch-designators /usr/ports/graphics/sswf/files/patch-designators
--- /usr/ports/graphics/sswf.orig/files/patch-designators	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/graphics/sswf/files/patch-designators	2011-06-20 23:57:41.000000000 +0200
@@ -0,0 +1,110 @@
+--- src/sswf/sswf_node.c.orig	2009-03-08 05:04:03.000000000 +0100
++++ src/sswf/sswf_node.c	2011-06-20 23:57:15.000000000 +0200
+@@ -2987,65 +2987,65 @@
+ 
+ 
+ #ifndef _MSVC
+-#define	DEF_PARAM(prm, value)		{ param: DEF_PARAM_##prm, { value } }
++#define	DEF_PARAM(prm, value)		{ .param = DEF_PARAM_##prm, { value } }
+ 
+ #define	DEF_START(name)			const struct definition_t node_def_##name[] = {	\
+-						DEF_PARAM(NAME, string: #name),
++						DEF_PARAM(NAME, .string = #name),
+ 
+-#define	DEF_END()			DEF_PARAM(END, ignored: 0) };
+-#define	DEF_LABEL(label)		DEF_PARAM(LABEL, string: label ),
+-#define	DEF_NOLABEL()			DEF_PARAM(LABEL, string: NULL ),
+-#define	DEF_REPEAT()			DEF_PARAM(REPEAT, ignored: 0),
+-#define	DEF_EMPTY()			DEF_PARAM(EMPTY, ignored: 0),
++#define	DEF_END()			DEF_PARAM(END, .ignored = 0) };
++#define	DEF_LABEL(label)		DEF_PARAM(LABEL, .string = label ),
++#define	DEF_NOLABEL()			DEF_PARAM(LABEL, .string = NULL ),
++#define	DEF_REPEAT()			DEF_PARAM(REPEAT, .ignored = 0),
++#define	DEF_EMPTY()			DEF_PARAM(EMPTY, .ignored = 0),
+ 
+ #define	DEF_OBJECT_REF()								\
+-	DEF_PARAM(TYPE, type: NODE_TYPE_OBJECT),					\
+-	DEF_PARAM(SUBTYPE, type: NODE_SUBTYPE_REFERENCE),
++	DEF_PARAM(TYPE, .type = NODE_TYPE_OBJECT),					\
++	DEF_PARAM(SUBTYPE, .type = NODE_SUBTYPE_REFERENCE),
+ 
+ #define	DEF_OBJECT(sub_type)								\
+-	DEF_PARAM(TYPE, type: NODE_TYPE_DATA),						\
+-	DEF_PARAM(SUBTYPE, type: NODE_SUBTYPE_##sub_type),
++	DEF_PARAM(TYPE, .type = NODE_TYPE_DATA),						\
++	DEF_PARAM(SUBTYPE, .type = NODE_SUBTYPE_##sub_type),
+ 
+ #define	DEF_OBJECT_OPT(sub_type)							\
+ 	DEF_OBJECT(sub_type)								\
+-	DEF_PARAM(OPTIONAL, ignored: 0),
++	DEF_PARAM(OPTIONAL, .ignored = 0),
+ 
+ #define	DEF_VALUE0(unit_nm, structure, end_t, field, defval)				\
+-	DEF_PARAM(TYPE, type: NODE_TYPE_FLOAT),						\
+-	DEF_PARAM(OFFSET, offset: offsetof(struct data_##structure##end_t, field)),	\
+-	DEF_PARAM(UNIT, unit: NODE_UNIT_##unit_nm),					\
+-	DEF_PARAM(DEFAULT, def_value: defval),
++	DEF_PARAM(TYPE, .type = NODE_TYPE_FLOAT),						\
++	DEF_PARAM(OFFSET, .offset = offsetof(struct data_##structure##end_t, field)),	\
++	DEF_PARAM(UNIT, .unit = NODE_UNIT_##unit_nm),					\
++	DEF_PARAM(DEFAULT, .def_value = defval),
+ 
+ #define	DEF_VALUE(unit, structure, field, def_value)					\
+ 	DEF_VALUE0(unit, structure, _t, field, def_value)
+ 
+ #define	DEF_VALUE_OPT(unit, structure, field, def_value)				\
+ 	DEF_VALUE0(unit, structure, _t, field, def_value)				\
+-	DEF_PARAM(OPTIONAL, ignored: 0),
++	DEF_PARAM(OPTIONAL, .ignored = 0),
+ 
+ #define	DEF_STRING()									\
+-	DEF_PARAM(TYPE, type: NODE_TYPE_STRING),
++	DEF_PARAM(TYPE, .type = NODE_TYPE_STRING),
+ 
+ #define	DEF_STRING_OPT()								\
+-	DEF_PARAM(TYPE, type: NODE_TYPE_STRING),					\
+-	DEF_PARAM(OPTIONAL, ignored: 0),
++	DEF_PARAM(TYPE, .type = NODE_TYPE_STRING),					\
++	DEF_PARAM(OPTIONAL, .ignored = 0),
+ 
+ #define	DEF_SET0(structure, end_t, field, value)					\
+-	DEF_PARAM(SET, set: value),							\
+-	DEF_PARAM(OFFSET, offset: offsetof(struct data_##structure##end_t, field)),
++	DEF_PARAM(SET, .set = value),							\
++	DEF_PARAM(OFFSET, .offset = offsetof(struct data_##structure##end_t, field)),
+ 
+ #define	DEF_SET(structure, field, value)						\
+ 	DEF_SET0(structure, _t, field, value)
+ 
+ #define	DEF_SIZE0(structure, end_t)							\
+-	DEF_PARAM(SIZE, size: sizeof(struct data_##structure##end_t)),
++	DEF_PARAM(SIZE, .size =  sizeof(struct data_##structure##end_t)),
+ 
+ #define	DEF_SIZE(structure)								\
+ 	DEF_SIZE0(structure, _t)
+ 
+ /*
+ #define	DEF_SEPARATOR()									\
+-	DEF_PARAM(SEPARATOR, ignored: 0),
++	DEF_PARAM(SEPARATOR, .ignored = 0),
+ */
+ #else
+ 
+@@ -3111,7 +3111,7 @@
+ 
+ #define	DEF_START(name)				DEF_PARAM(string, node_def_##name, NAME, #name)
+ 
+-//const struct definition_t node_def_##name[] = { DEF_PARAM(NAME, string: #name),
++//const struct definition_t node_def_##name[] = { DEF_PARAM(NAME, .string = #name),
+ 
+ #define	DEF_END()			DEF_PARAM_IGNORE(END)
+ #define	DEF_LABEL(label)		DEF_PARAM_AN(string, LABEL, label)
+@@ -3166,7 +3166,7 @@
+ 
+ /*
+ #define	DEF_SEPARATOR()									\
+-	DEF_PARAM(SEPARATOR, ignored: 0),
++	DEF_PARAM(SEPARATOR, .ignored = 0),
+ */
+ #endif
+ 
diff -ruN --exclude=CVS /usr/ports/graphics/sswf.orig/files/patch-extern /usr/ports/graphics/sswf/files/patch-extern
--- /usr/ports/graphics/sswf.orig/files/patch-extern	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/graphics/sswf/files/patch-extern	2011-06-21 00:04:14.000000000 +0200
@@ -0,0 +1,13 @@
+--- src/libasc/asc_strings.c++.orig	2011-06-21 00:02:53.000000000 +0200
++++ src/libasc/asc_strings.c++	2011-06-21 00:03:42.000000000 +0200
+@@ -4009,8 +4009,8 @@
+ ;
+ }
+ 
+-extern const int files_count = 46;
+-extern const char *files[] = {
++const int files_count = 46;
++const char *files[] = {
+ 	"include/sswf/scripts/extensions/trace.asc", file1,
+ 	"include/sswf/scripts/extensions/complex.asc", file2,
+ 	"include/sswf/scripts/global/extensions.asc", file3,
diff -ruN --exclude=CVS /usr/ports/graphics/sswf.orig/files/patch-libas_compile.cpp /usr/ports/graphics/sswf/files/patch-libas_compile.cpp
--- /usr/ports/graphics/sswf.orig/files/patch-libas_compile.cpp	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/graphics/sswf/files/patch-libas_compile.cpp	2011-06-20 23:17:27.000000000 +0200
@@ -0,0 +1,41 @@
+--- src/libas/compile.c++.orig	2011-06-20 23:06:36.000000000 +0200
++++ src/libas/compile.c++	2011-06-20 23:13:11.000000000 +0200
+@@ -706,18 +706,7 @@
+ 	//	frames and then we search that array with each
+ 	//	parent of the label
+ 
+-#ifdef _MSVC
+-	// alloca() not available with cl
+-	class AutoDelete {
+-	public: AutoDelete(NodePtr *ptr) { f_ptr = ptr; }
+-		~AutoDelete() { delete f_ptr; }
+-	private: NodePtr *f_ptr;
+-	};
+ 	NodePtr *parents = new NodePtr[count];
+-	AutoDelete ad_parent(parents);
+-#else
+-	NodePtr parents[count];
+-#endif
+ 	parent = goto_node;
+ 	for(idx = 0; idx < count; ++idx) {
+ 		parent = parent.GetParent();
+@@ -731,16 +720,19 @@
+ 		parent = parent.GetParent();
+ 		if(!parent.HasNode()) {
+ 			f_error_stream->ErrMsg(AS_ERR_INTERNAL_ERROR, goto_node, "IntCompiler::Goto(): Out of parent before we find the common node?!");
++			delete parents;
+ 			AS_ASSERT(0);
+ 			return;
+ 		}
+ 		for(idx = 0; idx < count; ++idx) {
+ 			if(parents[idx].SameAs(parent)) {
+ 				goto_node.SetLink(NodePtr::LINK_GOTO_EXIT, parent);
++				delete parents;
+ 				return;
+ 			}
+ 		}
+ 	}
++	delete parents;
+ }
+ 
+ 
--- sswf-1.8.4_2.patch ends here ---

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



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