Bug 158077 - [PATCH] graphics/sswf: update to allow compilation with clang
Summary: [PATCH] graphics/sswf: update to allow compilation with clang
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: Rene Ladan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 23:20 UTC by Marcin Cieślak
Modified: 2011-08-05 07:40 UTC (History)
1 user (show)

See Also:


Attachments
sswf-1.8.4_2.patch (7.63 KB, patch)
2011-06-20 23:20 UTC, Marcin Cieślak
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Cieślak 2011-06-20 23:20:05 UTC
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

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,
--------------------------------------

How-To-Repeat: 
Compile using clang instead of gcc
Comment 1 Rene Ladan freebsd_committer freebsd_triage 2011-07-30 13:39:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rene

Grab
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-07-30 14:28:32 UTC
rene        2011-07-30 13:28:23 UTC

  FreeBSD ports repository

  Modified files:
    graphics/sswf        Makefile 
  Added files:
    graphics/sswf/files  patch-src_libas_compile.c++ 
                         patch-src_libasc_asc__strings.c++ 
                         patch-src_sswf_sswf__node.c 
  Log:
  - Fix build with clang [1]
  - Pet portlint [1]
  
  Rename new patch files to match the current port style and
  http://www.freebsd.org/doc/en/books/porters-handbook/slow-patch.html
  PR:             ports/158077
  Submitted by:   Marcin Cieslak [saper saper.info]
  
  Revision  Changes    Path
  1.17      +1 -1      ports/graphics/sswf/Makefile
  1.1       +41 -0     ports/graphics/sswf/files/patch-src_libas_compile.c++ (new)
  1.1       +13 -0     ports/graphics/sswf/files/patch-src_libasc_asc__strings.c++ (new)
  1.1       +110 -0    ports/graphics/sswf/files/patch-src_sswf_sswf__node.c (new)
_______________________________________________
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"
Comment 3 Rene Ladan freebsd_committer freebsd_triage 2011-07-30 14:28:47 UTC
State Changed
From-To: open->feedback

Committed with renamed patch files, see 
http://www.freebsd.org/doc/en/books/porters-handbook/slow-patch.html 

Are you interested in becoming the maintainer?
Comment 4 Rene Ladan freebsd_committer freebsd_triage 2011-08-05 07:38:53 UTC
State Changed
From-To: feedback->closed

Close, maintainership can be claimed later