projects
/
SXSI
/
xpathcomp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43501e3
)
Add runtime assertion to check that values passed to Obj_val()
author
Kim Nguyễn
<kn@lri.fr>
Sat, 13 Oct 2012 12:54:02 +0000
(14:54 +0200)
committer
Kim Nguyễn
<kn@lri.fr>
Sat, 13 Oct 2012 12:54:02 +0000
(14:54 +0200)
are indeed custom blocks.
myocamlbuild.ml
patch
|
blob
|
history
src/common_stub.hpp
patch
|
blob
|
history
diff --git
a/myocamlbuild.ml
b/myocamlbuild.ml
index
7a792d1
..
6f27e4e
100644
(file)
--- a/
myocamlbuild.ml
+++ b/
myocamlbuild.ml
@@
-127,7
+127,7
@@
let () = dispatch begin
compile_flags @= [A "-noassert"];
pp_macro_options @= [ A "-unsafe" ];
native_compile_flags @= [ A "-inline"; A ocaml_inline ];
- cxx_flags @= [ A "-O3" ]
+ cxx_flags @= [ A "-O3"
; A "-DNDEBUG"
]
end;
let dir_path = Pathname.pwd / src_path in
diff --git
a/src/common_stub.hpp
b/src/common_stub.hpp
index
3e874b7
..
45aa0ca
100644
(file)
--- a/
src/common_stub.hpp
+++ b/
src/common_stub.hpp
@@
-14,6
+14,7
@@
extern "C" {
}
#include <typeinfo>
#include <cstdio>
+#include <cassert>
#define NoAlloc
@@
-26,6
+27,7
@@
value alloc_custom_(char* name);
template <class X> X& Obj_val(value v)
{
+ assert(Tag_val(v) == Custom_tag);
return * (X*) Data_custom_val(v);
}