Skip to content

Commit 0ab9923

Browse files
saschanazkripken
authored andcommitted
Remove deprecated components (#5773)
and gcc_demangler.js
1 parent b5a8cac commit 0ab9923

File tree

17 files changed

+1
-26909
lines changed

17 files changed

+1
-26909
lines changed

src/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ var EXPORTED_FUNCTIONS = ['_main'];
422422
var EXPORT_ALL = 0; // If true, we export all the symbols. Note that this does *not* affect LLVM, so it can
423423
// still eliminate functions as dead. This just exports them on the Module object.
424424
var EXPORT_BINDINGS = 0; // Export all bindings generator functions (prefixed with emscripten_bind_). This
425-
// is necessary to use the WebIDL binder or bindings generator with asm.js
425+
// is necessary to use the WebIDL binder with asm.js
426426
var EXPORT_FUNCTION_TABLES = 0; // If true, export all the functions appearing in a function table, and the
427427
// tables themselves.
428428
var RETAIN_COMPILER_SETTINGS = 0; // Remembers the values of these settings, and makes them accessible

tests/test_core.py

Lines changed: 0 additions & 294 deletions
Original file line numberDiff line numberDiff line change
@@ -6470,300 +6470,6 @@ def test_embind_f_no_rtti(self):
64706470
'''
64716471
self.do_run(src, '418')
64726472

6473-
@sync
6474-
@no_wasm_backend()
6475-
def test_scriptaclass(self):
6476-
Settings.EXPORT_BINDINGS = 1
6477-
6478-
header_filename = os.path.join(self.get_dir(), 'header.h')
6479-
header = '''
6480-
struct ScriptMe {
6481-
int value;
6482-
ScriptMe(int val);
6483-
int getVal(); // XXX Sadly, inlining these will result in LLVM not
6484-
// producing any code for them (when just building
6485-
// as a library)
6486-
void mulVal(int mul);
6487-
};
6488-
'''
6489-
h = open(header_filename, 'w')
6490-
h.write(header)
6491-
h.close()
6492-
6493-
src = '''
6494-
#include "header.h"
6495-
6496-
ScriptMe::ScriptMe(int val) : value(val) { }
6497-
int ScriptMe::getVal() { return value; }
6498-
void ScriptMe::mulVal(int mul) { value *= mul; }
6499-
'''
6500-
6501-
# Way 1: use demangler and namespacer
6502-
6503-
script_src = '''
6504-
var sme = Module._.ScriptMe.__new__(83); // malloc(sizeof(ScriptMe)), ScriptMe::ScriptMe(sme, 83) / new ScriptMe(83) (at addr sme)
6505-
Module._.ScriptMe.mulVal(sme, 2); // ScriptMe::mulVal(sme, 2) sme.mulVal(2)
6506-
Module.print('*' + Module._.ScriptMe.getVal(sme) + '*');
6507-
_free(sme);
6508-
Module.print('*ok*');
6509-
'''
6510-
post = '''
6511-
def process(filename):
6512-
Popen([PYTHON, DEMANGLER, filename], stdout=open(filename + '.tmp', 'w')).communicate()
6513-
Popen([PYTHON, NAMESPACER, filename, filename + '.tmp'], stdout=open(filename + '.tmp2', 'w')).communicate()
6514-
src = open(filename, 'r').read().replace(
6515-
'// {{MODULE_ADDITIONS}',
6516-
'Module["_"] = ' + open(filename + '.tmp2', 'r').read().replace('var ModuleNames = ', '').rstrip() + ';\n\n' + script_src + '\n\n' +
6517-
'// {{MODULE_ADDITIONS}'
6518-
)
6519-
open(filename, 'w').write(src)
6520-
'''
6521-
# XXX disable due to possible v8 bug -- self.do_run(src, '*166*\n*ok*', post_build=post)
6522-
6523-
if '-O2' in self.emcc_args and 'ASM_JS=0' not in self.emcc_args: # without asm, closure minifies Math.imul badly
6524-
self.emcc_args += ['--closure', '1'] # Use closure here, to test we export things right
6525-
6526-
# Way 2: use CppHeaderParser
6527-
6528-
header = '''
6529-
#include <stdio.h>
6530-
6531-
class Parent {
6532-
protected:
6533-
int value;
6534-
public:
6535-
Parent(int val);
6536-
Parent(Parent *p, Parent *q); // overload constructor
6537-
int getVal() { return value; }; // inline should work just fine here, unlike Way 1 before
6538-
void mulVal(int mul);
6539-
};
6540-
6541-
class Child1 : public Parent {
6542-
public:
6543-
Child1() : Parent(7) { printf("Child1:%d\\n", value); };
6544-
Child1(int val) : Parent(val*2) { value -= 1; printf("Child1:%d\\n", value); };
6545-
int getValSqr() { return value*value; }
6546-
int getValSqr(int more) { return value*value*more; }
6547-
int getValTimes(int times=1) { return value*times; }
6548-
};
6549-
6550-
class Child2 : public Parent {
6551-
public:
6552-
Child2() : Parent(9) { printf("Child2:%d\\n", value); };
6553-
int getValCube() { return value*value*value; }
6554-
static void printStatic() { printf("*static*\\n"); }
6555-
6556-
virtual void virtualFunc() { printf("*virtualf*\\n"); }
6557-
virtual void virtualFunc2() { printf("*virtualf2*\\n"); }
6558-
static void runVirtualFunc(Child2 *self) { self->virtualFunc(); };
6559-
private:
6560-
void doSomethingSecret() { printf("security breached!\\n"); }; // we should not be able to do this
6561-
};
6562-
'''
6563-
open(header_filename, 'w').write(header)
6564-
6565-
basename = os.path.join(self.get_dir(), 'bindingtest')
6566-
output = Popen([PYTHON, BINDINGS_GENERATOR, basename, header_filename], stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]
6567-
#print output
6568-
assert 'Traceback' not in output, 'Failure in binding generation: ' + output
6569-
6570-
src = '''
6571-
#include "header.h"
6572-
6573-
Parent::Parent(int val) : value(val) { printf("Parent:%d\\n", val); }
6574-
Parent::Parent(Parent *p, Parent *q) : value(p->value + q->value) { printf("Parent:%d\\n", value); }
6575-
void Parent::mulVal(int mul) { value *= mul; }
6576-
6577-
#include "bindingtest.cpp"
6578-
'''
6579-
6580-
post2 = '''
6581-
def process(filename):
6582-
src = open(filename, 'a')
6583-
src.write(open('bindingtest.js').read() + '\\n\\n')
6584-
src.close()
6585-
'''
6586-
6587-
def post3(filename):
6588-
script_src_2 = '''
6589-
var sme = new Module.Parent(42);
6590-
sme.mulVal(2);
6591-
Module.print('*')
6592-
Module.print(sme.getVal());
6593-
6594-
Module.print('c1');
6595-
6596-
var c1 = new Module.Child1();
6597-
Module.print(c1.getVal());
6598-
c1.mulVal(2);
6599-
Module.print(c1.getVal());
6600-
Module.print(c1.getValSqr());
6601-
Module.print(c1.getValSqr(3));
6602-
Module.print(c1.getValTimes()); // default argument should be 1
6603-
Module.print(c1.getValTimes(2));
6604-
6605-
Module.print('c1 v2');
6606-
6607-
c1 = new Module.Child1(8); // now with a parameter, we should handle the overloading automatically and properly and use constructor #2
6608-
Module.print(c1.getVal());
6609-
c1.mulVal(2);
6610-
Module.print(c1.getVal());
6611-
Module.print(c1.getValSqr());
6612-
Module.print(c1.getValSqr(3));
6613-
6614-
Module.print('c2')
6615-
6616-
var c2 = new Module.Child2();
6617-
Module.print(c2.getVal());
6618-
c2.mulVal(2);
6619-
Module.print(c2.getVal());
6620-
Module.print(c2.getValCube());
6621-
var succeeded;
6622-
try {
6623-
succeeded = 0;
6624-
Module.print(c2.doSomethingSecret()); // should fail since private
6625-
succeeded = 1;
6626-
} catch(e) {}
6627-
Module.print(succeeded);
6628-
try {
6629-
succeeded = 0;
6630-
Module.print(c2.getValSqr()); // function from the other class
6631-
succeeded = 1;
6632-
} catch(e) {}
6633-
Module.print(succeeded);
6634-
try {
6635-
succeeded = 0;
6636-
c2.getValCube(); // sanity
6637-
succeeded = 1;
6638-
} catch(e) {}
6639-
Module.print(succeeded);
6640-
6641-
Module.Child2.prototype.printStatic(); // static calls go through the prototype
6642-
6643-
// virtual function
6644-
c2.virtualFunc();
6645-
Module.Child2.prototype.runVirtualFunc(c2);
6646-
c2.virtualFunc2();
6647-
6648-
// extend the class from JS
6649-
var c3 = new Module.Child2;
6650-
Module.customizeVTable(c3, [{
6651-
original: Module.Child2.prototype.virtualFunc,
6652-
replacement: function() {
6653-
Module.print('*js virtualf replacement*');
6654-
}
6655-
}, {
6656-
original: Module.Child2.prototype.virtualFunc2,
6657-
replacement: function() {
6658-
Module.print('*js virtualf2 replacement*');
6659-
}
6660-
}]);
6661-
c3.virtualFunc();
6662-
Module.Child2.prototype.runVirtualFunc(c3);
6663-
c3.virtualFunc2();
6664-
6665-
c2.virtualFunc(); // original should remain the same
6666-
Module.Child2.prototype.runVirtualFunc(c2);
6667-
c2.virtualFunc2();
6668-
Module.print('*ok*');
6669-
'''
6670-
code = open(filename).read()
6671-
src = open(filename, 'w')
6672-
src.write('var Module = {};\n') # name Module
6673-
src.write(code)
6674-
src.write(script_src_2 + '\n')
6675-
src.close()
6676-
6677-
Settings.RESERVED_FUNCTION_POINTERS = 20
6678-
6679-
self.do_run(src, '''*
6680-
84
6681-
c1
6682-
Parent:7
6683-
Child1:7
6684-
7
6685-
14
6686-
196
6687-
588
6688-
14
6689-
28
6690-
c1 v2
6691-
Parent:16
6692-
Child1:15
6693-
15
6694-
30
6695-
900
6696-
2700
6697-
c2
6698-
Parent:9
6699-
Child2:9
6700-
9
6701-
18
6702-
5832
6703-
0
6704-
0
6705-
1
6706-
*static*
6707-
*virtualf*
6708-
*virtualf*
6709-
*virtualf2*''' + ('''
6710-
Parent:9
6711-
Child2:9
6712-
*js virtualf replacement*
6713-
*js virtualf replacement*
6714-
*js virtualf2 replacement*
6715-
*virtualf*
6716-
*virtualf*
6717-
*virtualf2*''') + '''
6718-
*ok*
6719-
''', post_build=(post2, post3))
6720-
6721-
@sync
6722-
@no_wasm_backend()
6723-
def test_scriptaclass_2(self):
6724-
Settings.EXPORT_BINDINGS = 1
6725-
6726-
header_filename = os.path.join(self.get_dir(), 'header.h')
6727-
header = '''
6728-
#include <stdio.h>
6729-
#include <string.h>
6730-
6731-
class StringUser {
6732-
char *s;
6733-
int i;
6734-
public:
6735-
StringUser(char *string, int integer) : s(strdup(string)), i(integer) {}
6736-
void Print(int anotherInteger, char *anotherString) {
6737-
printf("|%s|%d|%s|%d|\\n", s, i, anotherString, anotherInteger);
6738-
}
6739-
void CallOther(StringUser *fr) { fr->Print(i, s); }
6740-
};
6741-
'''
6742-
open(header_filename, 'w').write(header)
6743-
6744-
basename = os.path.join(self.get_dir(), 'bindingtest')
6745-
output = Popen([PYTHON, BINDINGS_GENERATOR, basename, header_filename], stdout=PIPE, stderr=self.stderr_redirect).communicate()[0]
6746-
#print output
6747-
assert 'Traceback' not in output, 'Failure in binding generation: ' + output
6748-
6749-
src = '''
6750-
#include "header.h"
6751-
6752-
#include "bindingtest.cpp"
6753-
'''
6754-
6755-
post = '''
6756-
def process(filename):
6757-
src = open(filename, 'a')
6758-
src.write(open('bindingtest.js').read() + '\\n\\n')
6759-
src.write(\'\'\'
6760-
var user = new Module.StringUser("hello", 43);
6761-
user.Print(41, "world");
6762-
\'\'\')
6763-
src.close()
6764-
'''
6765-
self.do_run(src, '|hello|43|world|41|', post_build=post)
6766-
67676473
@sync
67686474
@no_wasm_backend()
67696475
def test_webidl(self):

0 commit comments

Comments
 (0)