aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@mozilla.com>2010-12-10 22:59:38 -0800
committerAlon Zakai <azakai@mozilla.com>2010-12-10 22:59:38 -0800
commitb74419d19e6e718cc966d4a610167a1029a1e064 (patch)
treef00378a121002662f5f1b41d6c70583abc4223d6
parent74338a84911ecab007cb929cc417f59bfbac600a (diff)
proper stubs for external values
-rw-r--r--src/jsifier.js2
-rw-r--r--tests/runner.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 3c758bff..ed42dae7 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -238,7 +238,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
} else {
item.JS = 'var ' + item.ident + ';';
var constant = item.external ?
- JSON.stringify(makeEmptyStruct(item.type)) + ' /* external value? */'
+ makePointer(JSON.stringify(makeEmptyStruct(item.type)) + ' /* external value? */', null, 'ALLOC_STATIC')
:
parseConst(item.value, item.type, item.ident);
if (typeof constant === 'object') {
diff --git a/tests/runner.py b/tests/runner.py
index 22a817bd..8d1f2eca 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1035,10 +1035,13 @@ if 'benchmark' not in sys.argv:
int values[6] = { 3, 2, 5, 1, 5, 6 };
qsort(values, 5, sizeof(int), comparer);
printf("*%d,%d,%d,%d,%d,%d*\\n", values[0], values[1], values[2], values[3], values[4], values[5]);
+
+ printf("*stdin==0:%d*\\n", stdin == 0); // check that external values are at least not NULL
+
return 0;
}
'''
- self.do_test(src, '*1,2,3,5,5,6*\n*cleaned*')
+ self.do_test(src, '*1,2,3,5,5,6*\n*stdin==0:0*\n*cleaned*')
def test_statics(self):
src = '''