aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2014-01-18 14:31:20 +0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-01-18 14:31:20 +0700
commit8762f317490f82ddadf8257d29f8dc2b074b2683 (patch)
treee716bdf760eacfa4ee89aa279931879c17270fad
parentab0a6e5a6fc4a5d25d19bdfaf818fc4151e95148 (diff)
Implement catopen/catgets/catclose to help libcxx tests pass.
-rw-r--r--src/library.js21
-rw-r--r--tests/core/test_nl_types.in8
-rw-r--r--tests/core/test_nl_types.out1
-rw-r--r--tests/test_core.py6
4 files changed, 35 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js
index f59cf3b3..b38a74bf 100644
--- a/src/library.js
+++ b/src/library.js
@@ -558,6 +558,25 @@ LibraryManager.library = {
},
// ==========================================================================
+ // nl_types.h
+ // ==========================================================================
+
+ catopen: function(name, oflag) {
+ // nl_catd catopen (const char *name, int oflag)
+ return -1;
+ },
+
+ catgets: function(catd, set_id, msg_id, s) {
+ // char *catgets (nl_catd catd, int set_id, int msg_id, const char *s)
+ return s;
+ },
+
+ catclose: function(catd) {
+ // int catclose (nl_catd catd)
+ return 0;
+ },
+
+ // ==========================================================================
// poll.h
// ==========================================================================
@@ -9155,7 +9174,7 @@ function autoAddDeps(object, name) {
}
// Add aborting stubs for various libc stuff needed by libc++
-['pthread_cond_signal', 'pthread_equal', 'pthread_join', 'pthread_detach', 'catgets', 'catopen', 'catclose'].forEach(function(aborter) {
+['pthread_cond_signal', 'pthread_equal', 'pthread_join', 'pthread_detach'].forEach(function(aborter) {
LibraryManager.library[aborter] = function aborting_stub() { throw 'TODO: ' + aborter };
});
diff --git a/tests/core/test_nl_types.in b/tests/core/test_nl_types.in
new file mode 100644
index 00000000..666920ee
--- /dev/null
+++ b/tests/core/test_nl_types.in
@@ -0,0 +1,8 @@
+#include <nl_types.h>
+#include <stdio.h>
+
+int main(int argc, char ** argv) {
+ nl_catd c = catopen("none", 0);
+ printf("Hello, %s.\n", catgets(c, 0, 0, "world"));
+ return catclose(c);
+}
diff --git a/tests/core/test_nl_types.out b/tests/core/test_nl_types.out
new file mode 100644
index 00000000..f75ba05f
--- /dev/null
+++ b/tests/core/test_nl_types.out
@@ -0,0 +1 @@
+Hello, world.
diff --git a/tests/test_core.py b/tests/test_core.py
index 841800df..b1e1ffe6 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4294,6 +4294,12 @@ def process(filename):
self.do_run_from_file(src, output)
+ def test_nl_types(self):
+ test_path = path_from_root('tests', 'core', 'test_nl_types')
+ src, output = (test_path + s for s in ('.in', '.out'))
+
+ self.do_run_from_file(src, output)
+
def test_799(self):
src = open(path_from_root('tests', '799.cpp'), 'r').read()
self.do_run(src, '''Set PORT family: 0, port: 3979