diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-14 19:30:16 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-14 19:30:16 -0500 |
commit | 5466df2a6197e700a8e9d2b32e6c61eae7279ea3 (patch) | |
tree | 2ddc81319bd72c13801f4398fd83b9538115cda7 | |
parent | e6a4d7effcf522343051bf62abe074712858b3c3 (diff) | |
parent | eb56795d36b7079b3b6a627c79be10789e028dec (diff) |
Merge branch 'master' into incoming
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | src/library.js | 2 | ||||
-rwxr-xr-x | tests/runner.py | 21 |
3 files changed, 23 insertions, 1 deletions
@@ -13,5 +13,6 @@ under the licensing terms detailed in LICENSE. * David Yip <yipdw@member.fsf.org> * Julien Hamaide <julien.hamaide@gmail.com> * Ehsan Akhgari <ehsan.akhgari@gmail.com> (copyright owned by Mozilla Foundation) +* Adrian Taylor <adrian@macrobug.com> diff --git a/src/library.js b/src/library.js index aee4a416..e0a38817 100644 --- a/src/library.js +++ b/src/library.js @@ -3296,7 +3296,7 @@ LibraryManager.library = { }, atexit: function(func, arg) { - __ATEXIT__.push({ func: func, arg: arg }); + __ATEXIT__.unshift({ func: func, arg: arg }); }, __cxa_atexit: 'atexit', diff --git a/tests/runner.py b/tests/runner.py index e2bb13d4..ac422e9e 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -2439,6 +2439,27 @@ def process(filename): self.do_run(src, '*1*', force_c=True) + def test_atexit(self): + # Confirms they are called in reverse order + src = r''' + #include <stdio.h> + #include <stdlib.h> + + static void cleanA() { + printf("A"); + } + static void cleanB() { + printf("B"); + } + + int main() { + atexit(cleanA); + atexit(cleanB); + return 0; + } + ''' + self.do_run(src, 'BA') + def test_time(self): # XXX Not sure what the right output is here. Looks like the test started failing with daylight savings changes. Modified it to pass again. src = open(path_from_root('tests', 'time', 'src.c'), 'r').read() |