js.patch 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. Index: JavaScript-0.55/JavaScript.xs
  2. --- JavaScript-0.55/JavaScript.xs.orig 2005-06-29 21:07:06 +0200
  3. +++ JavaScript-0.55/JavaScript.xs 2006-03-06 22:39:04 +0100
  4. @@ -6,7 +6,7 @@
  5. #else
  6. #include <jsapi.h>
  7. #endif
  8. -#include <malloc.h>
  9. +#include <stdlib.h>
  10. #define _IS_UNDEF(a) (SvANY(a) == SvANY(&PL_sv_undef))
  11. Index: JavaScript-0.55/Makefile.PL
  12. --- JavaScript-0.55/Makefile.PL.orig 2005-06-28 23:49:03 +0200
  13. +++ JavaScript-0.55/Makefile.PL 2006-03-06 22:39:04 +0100
  14. @@ -10,30 +10,13 @@
  15. $define .= " -DXP_UNIX";
  16. }
  17. -my $inc = '';
  18. -
  19. -if(-f "/etc/gentoo-release") {
  20. - # Gentoo puts libjs in a slightly hidden spot.
  21. - $inc = '-I/usr/lib/MozillaFirefox/include/js/ -I/usr/lib/MozillaFirefox/';
  22. -}
  23. -
  24. -#test for debian type include files...
  25. -if (-f "/usr/include/smjs/jsapi.h" or -f "/usr/local/include/smjs/jsapi.h") {
  26. - $define .= " -DINCLUDES_IN_SMJS"
  27. -}
  28. +my $inc = '-I../js/src';
  29. if($ENV{JS_THREADSAFE}) {
  30. $define .= " -DJS_THREADSAFE";
  31. }
  32. -my $lib = "-ljs";
  33. -#test for debian type libsmjs
  34. -#this could probably be done better, but I'm not sure how to
  35. -#get this platform independant
  36. -if (-f "/usr/lib/libsmjs.so" or -f "/usr/local/lib/libsmjs.so") {
  37. - $lib = "-lsmjs";
  38. -}
  39. -
  40. +my $lib = "-L../js/src -ljs";
  41. WriteMakefile(
  42. 'NAME' => 'JavaScript',
  43. Index: JavaScript-SpiderMonkey-0.16/Makefile.PL
  44. --- JavaScript-SpiderMonkey-0.16/Makefile.PL.orig 2006-02-28 18:13:08 +0100
  45. +++ JavaScript-SpiderMonkey-0.16/Makefile.PL 2006-03-06 22:39:27 +0100
  46. @@ -108,7 +108,6 @@
  47. 'NAME' => 'JavaScript::SpiderMonkey',
  48. 'VERSION_FROM' => 'SpiderMonkey.pm', # finds $VERSION
  49. 'PREREQ_PM' => {
  50. - 'Log::Log4perl' => 0,
  51. 'Data::Dumper' => 0,
  52. }, # e.g., Module::Name => 1.1
  53. ($] >= 5.005 ? ## Add these new keywords supported since 5.005
  54. Index: JavaScript-SpiderMonkey-0.16/SpiderMonkey.pm
  55. --- JavaScript-SpiderMonkey-0.16/SpiderMonkey.pm.orig 2006-03-06 17:48:27 +0100
  56. +++ JavaScript-SpiderMonkey-0.16/SpiderMonkey.pm 2006-03-06 22:39:04 +0100
  57. @@ -75,7 +75,6 @@
  58. use strict;
  59. use warnings;
  60. use Data::Dumper;
  61. -use Log::Log4perl qw(:easy);
  62. require Exporter;
  63. require DynaLoader;
  64. @@ -555,14 +554,7 @@
  65. ##################################################
  66. sub debug_enabled {
  67. ##################################################
  68. - my $logger = Log::Log4perl::get_logger("JavaScript::SpiderMonkey");
  69. - if(Log::Log4perl->initialized() and $logger->is_debug()) {
  70. - # print "DEBUG IS ENABLED\n";
  71. - return 1;
  72. - } else {
  73. - # print "DEBUG IS DISABLED\n";
  74. - return 0;
  75. - }
  76. + return 0;
  77. }
  78. 1;
  79. Index: js/src/jsapi.c
  80. --- js/src/jsapi.c.orig 2005-10-22 12:19:14 +0200
  81. +++ js/src/jsapi.c 2006-03-06 22:39:04 +0100
  82. @@ -125,7 +125,7 @@
  83. static JSBool
  84. TryArgumentFormatter(JSContext *cx, const char **formatp, JSBool fromJS,
  85. - jsval **vpp, va_list *app)
  86. + jsval **vpp, va_list app)
  87. {
  88. const char *format;
  89. JSArgumentFormatMap *map;
  90. @@ -263,8 +263,7 @@
  91. break;
  92. default:
  93. format--;
  94. - if (!TryArgumentFormatter(cx, &format, JS_TRUE, &sp,
  95. - JS_ADDRESSOF_VA_LIST(ap))) {
  96. + if (!TryArgumentFormatter(cx, &format, JS_TRUE, &sp, ap)) {
  97. return JS_FALSE;
  98. }
  99. /* NB: the formatter already updated sp, so we continue here. */
  100. @@ -366,8 +365,7 @@
  101. break;
  102. default:
  103. format--;
  104. - if (!TryArgumentFormatter(cx, &format, JS_FALSE, &sp,
  105. - JS_ADDRESSOF_VA_LIST(ap))) {
  106. + if (!TryArgumentFormatter(cx, &format, JS_FALSE, &sp, ap)) {
  107. goto bad;
  108. }
  109. /* NB: the formatter already updated sp, so we continue here. */
  110. @@ -2211,7 +2209,7 @@
  111. JSAtom *atom;
  112. if (attrs & JSPROP_INDEX) {
  113. - id = INT_TO_JSVAL((jsint)name);
  114. + id = INT_TO_JSVAL(name);
  115. atom = NULL;
  116. attrs &= ~JSPROP_INDEX;
  117. } else {
  118. Index: js/src/jscntxt.c
  119. --- js/src/jscntxt.c.orig 2004-08-19 19:57:36 +0200
  120. +++ js/src/jscntxt.c 2006-03-06 22:39:04 +0100
  121. @@ -334,7 +334,7 @@
  122. {
  123. const JSResolvingKey *key = (const JSResolvingKey *)ptr;
  124. - return ((JSDHashNumber)key->obj >> JSVAL_TAGBITS) ^ key->id;
  125. + return ((JSDHashNumber)JS_PTR_TO_UINT32(key->obj) >> JSVAL_TAGBITS) ^ key->id;
  126. }
  127. JS_PUBLIC_API(JSBool)
  128. Index: js/src/jsdtoa.c
  129. --- js/src/jsdtoa.c.orig 2004-04-04 00:11:11 +0200
  130. +++ js/src/jsdtoa.c 2006-03-06 22:39:04 +0100
  131. @@ -257,7 +257,7 @@
  132. #define word1(x) JSDOUBLE_LO32(x)
  133. #define set_word1(x, y) JSDOUBLE_SET_LO32(x, y)
  134. -#define Storeinc(a,b,c) (*(a)++ = (b) << 16 | (c) & 0xffff)
  135. +#define Storeinc(a,b,c) (*(a)++ = (b) << 16 | ((c) & 0xffff))
  136. /* #define P DBL_MANT_DIG */
  137. /* Ten_pmax = floor(P*log(2)/log(5)) */
  138. @@ -989,7 +989,8 @@
  139. static double ulp(double x)
  140. {
  141. register Long L;
  142. - double a;
  143. + double a = 0.; /* only need to initialize to calm the compiler.
  144. + * set_word0 and set_word1 set a, but in two stages */
  145. L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
  146. #ifndef Sudden_Underflow
  147. @@ -1020,7 +1021,7 @@
  148. {
  149. ULong *xa, *xa0, w, y, z;
  150. int32 k;
  151. - double d;
  152. + double d = 0.;
  153. #define d0 word0(d)
  154. #define d1 word1(d)
  155. #define set_d0(x) set_word0(d, x)
  156. @@ -1836,6 +1837,7 @@
  157. }
  158. #ifdef Avoid_Underflow
  159. if (scale) {
  160. + rv0 = 0.; /* calm the compiler warning */
  161. set_word0(rv0, Exp_1 - P*Exp_msk1);
  162. set_word1(rv0, 0);
  163. if ((word0(rv) & Exp_mask) <= P*Exp_msk1
  164. Index: js/src/jsinterp.c
  165. --- js/src/jsinterp.c.orig 2004-09-24 04:16:49 +0200
  166. +++ js/src/jsinterp.c 2006-03-06 22:39:04 +0100
  167. @@ -1741,11 +1741,11 @@
  168. void *mark;
  169. jsbytecode *pc, *pc2, *endpc;
  170. JSOp op, op2;
  171. - const JSCodeSpec *cs;
  172. + const JSCodeSpec *cs = NULL;
  173. JSAtom *atom;
  174. uintN argc, slot, attrs;
  175. jsval *vp, lval, rval, ltmp, rtmp;
  176. - jsid id;
  177. + jsid id = -1L; /* initialize to something awful */
  178. JSObject *withobj, *origobj, *propobj;
  179. jsval iter_state;
  180. JSProperty *prop;
  181. @@ -1757,7 +1757,7 @@
  182. JSFunction *fun;
  183. JSType type;
  184. #ifdef DEBUG
  185. - FILE *tracefp;
  186. + FILE *tracefp = NULL;
  187. #endif
  188. #if JS_HAS_EXPORT_IMPORT
  189. JSIdArray *ida;
  190. @@ -1834,6 +1834,7 @@
  191. !JS_CHECK_STACK_SIZE(cx, stackDummy)) {
  192. JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_OVER_RECURSED);
  193. ok = JS_FALSE;
  194. + sp = NULL;
  195. goto out;
  196. }
  197. @@ -1843,6 +1844,7 @@
  198. newsp = js_AllocRawStack(cx, (uintN)(2 * depth), &mark);
  199. if (!newsp) {
  200. ok = JS_FALSE;
  201. + sp = NULL;
  202. goto out;
  203. }
  204. sp = newsp + depth;
  205. Index: js/src/jsosdep.h
  206. --- js/src/jsosdep.h.orig 2003-11-15 01:10:59 +0100
  207. +++ js/src/jsosdep.h 2006-03-06 22:39:04 +0100
  208. @@ -101,7 +101,7 @@
  209. #elif defined(SOLARIS)
  210. #define JS_HAVE_LONG_LONG
  211. -#elif defined(FREEBSD)
  212. +#elif defined(FREEBSD) || defined(__FreeBSD__)
  213. #define JS_HAVE_LONG_LONG
  214. #elif defined(SUNOS4)
  215. Index: js/src/jspubtd.h
  216. --- js/src/jspubtd.h.orig 2004-06-15 18:38:43 +0200
  217. +++ js/src/jspubtd.h 2006-03-06 22:39:04 +0100
  218. @@ -531,7 +531,7 @@
  219. typedef JSBool
  220. (* JS_DLL_CALLBACK JSArgumentFormatter)(JSContext *cx, const char *format,
  221. JSBool fromJS, jsval **vpp,
  222. - va_list *app);
  223. + va_list app);
  224. #endif
  225. typedef JSBool
  226. Index: js/src/jstypes.h
  227. --- js/src/jstypes.h.orig 2003-11-15 01:11:04 +0100
  228. +++ js/src/jstypes.h 2006-03-06 22:39:04 +0100
  229. @@ -203,6 +203,19 @@
  230. #define JS_BITMASK(n) (JS_BIT(n) - 1)
  231. /***********************************************************************
  232. +** MACROS: JS_PTR_TO_INT32
  233. +** JS_PTR_TO_UINT32
  234. +** JS_INT32_TO_PTR
  235. +** JS_UINT32_TO_PTR
  236. +** DESCRIPTION:
  237. +** Integer to pointer and pointer to integer conversion macros.
  238. +***********************************************************************/
  239. +#define JS_PTR_TO_INT32(x) ((jsint)((char *)(x) - (char *)0))
  240. +#define JS_PTR_TO_UINT32(x) ((jsuint)((char *)(x) - (char *)0))
  241. +#define JS_INT32_TO_PTR(x) ((void *)((char *)0 + (jsint)(x)))
  242. +#define JS_UINT32_TO_PTR(x) ((void *)((char *)0 + (jsuint)(x)))
  243. +
  244. +/***********************************************************************
  245. ** MACROS: JS_HOWMANY
  246. ** JS_ROUNDUP
  247. ** JS_MIN
  248. Index: js/src/perlconnect/JS.xs
  249. --- js/src/perlconnect/JS.xs.orig 2005-02-12 21:10:34 +0100
  250. +++ js/src/perlconnect/JS.xs 2006-03-06 22:39:04 +0100
  251. @@ -61,7 +61,7 @@
  252. #include <jsapi.h>
  253. #include "jsperlpvt.h"
  254. -#include <malloc.h>
  255. +#include <stdlib.h>
  256. /* __REMOVE__ */
  257. /* #include <stdio.h> */
  258. Index: js/src/rules.mk
  259. --- js/src/rules.mk.orig 2003-11-15 01:11:04 +0100
  260. +++ js/src/rules.mk 2006-03-06 22:39:04 +0100
  261. @@ -58,7 +58,7 @@
  262. # TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
  263. TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now
  264. else
  265. -TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
  266. +TARGETS += $(LIBRARY) $(PROGRAM)
  267. endif
  268. all:
  269. Index: js/src/config/SunOS5.10_i86pc.mk
  270. --- js/src/config/SunOS5.10_i86pc.mk.orig 2006-06-06 14:24:18.124955215 +0200
  271. +++ js/src/config/SunOS5.10_i86pc.mk 2006-06-06 14:24:07.034374207 +0200
  272. @@ -0,0 +1,16 @@
  273. +
  274. +CC = gcc
  275. +LD = ld
  276. +CCC = g++
  277. +CFLAGS += -Wall -Wno-format
  278. +MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS)
  279. +RANLIB = echo
  280. +CPU_ARCH = $(shell uname -m)
  281. +GFX_ARCH = x
  282. +OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -DHAVE_LOCALTIME_R -DHAVE_VA_COPY -DVA_COPY=va_copy -DPIC -fPIC
  283. +OS_LIBS = -lsocket -lnsl -ldl
  284. +LDFLAGS =
  285. +NOSUCHFILE = /solaris-rm-f-sucks
  286. +JS_EDITLINE = 1
  287. +OS_TEST = i86pc
  288. +
  289. Index: js/src/config.mk
  290. --- js/src/config.mk.orig 2003-11-15 01:10:55.000000000 +0100
  291. +++ js/src/config.mk 2006-06-06 14:32:09.769085477 +0200
  292. @@ -114,7 +114,7 @@
  293. ifdef BUILD_OPT
  294. OPTIMIZER = -O
  295. -DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
  296. +DEFINES += -UDEBUG -DNDEBUG
  297. OBJDIR_TAG = _OPT
  298. else
  299. ifdef USE_MSVC
  300. @@ -122,7 +122,7 @@
  301. else
  302. OPTIMIZER = -g
  303. endif
  304. -DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
  305. +DEFINES += -DDEBUG
  306. OBJDIR_TAG = _DBG
  307. endif