|
From: <sv...@va...> - 2009-12-29 14:11:50
|
Author: bart
Date: 2009-12-29 14:11:38 +0000 (Tue, 29 Dec 2009)
New Revision: 10970
Log:
Changes:
- Made sure that C++ compilers do not complain about the header files
include/pub_tool_libcassert.h and include/pub_tool_basics.h.
- Added the source file none/tests/valgrind_cpp_test.cpp. This source file
is compiled together with the regression tests in order to verify that
Valgrind's public header files compile cleanly with a C++ compiler.
These modifications are based on a patch provided by Konstantin Serebryany.
Added:
trunk/none/tests/valgrind_cpp_test.cpp
Modified:
trunk/include/pub_tool_basics.h
trunk/include/pub_tool_libcassert.h
trunk/none/tests/
trunk/none/tests/Makefile.am
Modified: trunk/include/pub_tool_basics.h
===================================================================
--- trunk/include/pub_tool_basics.h 2009-12-21 11:29:54 UTC (rev 10969)
+++ trunk/include/pub_tool_basics.h 2009-12-29 14:11:38 UTC (rev 10970)
@@ -193,15 +193,18 @@
SysRes;
#elif defined(VGO_darwin)
typedef
+ enum {
+ SysRes_MACH=40, // MACH, result is _wLO
+ SysRes_MDEP, // MDEP, result is _wLO
+ SysRes_UNIX_OK, // UNIX, success, result is _wHI:_wLO
+ SysRes_UNIX_ERR // UNIX, error, error is _wHI:_wLO
+ }
+ SysResMode;
+typedef
struct {
UWord _wLO;
UWord _wHI;
- enum {
- SysRes_MACH=40, // MACH, result is _wLO
- SysRes_MDEP, // MDEP, result is _wLO
- SysRes_UNIX_OK, // UNIX, success, result is _wHI:_wLO
- SysRes_UNIX_ERR // UNIX, error, error is _wHI:_wLO
- } _mode;
+ SysResMode _mode;
}
SysRes;
#else
Modified: trunk/include/pub_tool_libcassert.h
===================================================================
--- trunk/include/pub_tool_libcassert.h 2009-12-21 11:29:54 UTC (rev 10969)
+++ trunk/include/pub_tool_libcassert.h 2009-12-29 14:11:38 UTC (rev 10970)
@@ -33,15 +33,17 @@
#define tl_assert(expr) \
((void) ((expr) ? 0 : \
- (VG_(assert_fail) (/*isCore?*/False, #expr, \
- __FILE__, __LINE__, __PRETTY_FUNCTION__, \
- ""), \
+ (VG_(assert_fail) (/*isCore?*/False, (const Char*)#expr, \
+ (const Char*)__FILE__, __LINE__, \
+ (const Char*)__PRETTY_FUNCTION__, \
+ (const HChar*)""), \
0)))
#define tl_assert2(expr, format, args...) \
((void) ((expr) ? 0 : \
- (VG_(assert_fail) (/*isCore?*/False, #expr, \
- __FILE__, __LINE__, __PRETTY_FUNCTION__, \
+ (VG_(assert_fail) (/*isCore?*/False, (const Char*)#expr, \
+ (const Char*)__FILE__, __LINE__, \
+ (const Char*)__PRETTY_FUNCTION__, \
format, ##args), \
0)))
Property changes on: trunk/none/tests
___________________________________________________________________
Name: svn:ignore
- *.dSYM
*.so
*.stderr.diff*
*.stderr.out
*.stdout.diff*
*.stdout.out
.deps
ansi
args
async-sigs
as_mmap
as_shm
bitfield1
blockfault
bug129866
closeall
coolo_sigaction
coolo_strlen
discard
exec-sigmask
execve
faultstatus
fcntl_setown
fdleak_cmsg
fdleak_creat
fdleak_dup
fdleak_dup2
fdleak_fcntl
fdleak_ipv4
fdleak_open
fdleak_pipe
fdleak_socketpair
floored
fork
fucomip
gxx304
insn_basic
insn_basic.c
insn_cmov
insn_cmov.c
insn_fpu
insn_fpu.c
insn_mmx
insn_mmx.c
insn_mmxext
insn_mmxext.c
insn_sse
insn_sse.c
insn_sse2
insn_sse2.c
Makefile
Makefile.in
manythreads
map_unaligned
map_unmap
mq
mremap
mremap2
munmap_exe
nestedfns
pending
pluto
procfs-cmdline-exe
pth_atfork1
pth_blockedsig
pth_cancel1
pth_cancel2
pth_cvsimple
pth_detached
pth_empty
pth_exit
pth_exit2
pth_mutexspeed
pth_once
pth_rwlock
pth_semaphore1
pth_simple_mutex
pth_simple_threads
pth_specific
pth_stackalign
pth_yield
rcrl
readline1
resolv
res_search
rlimit_nofile
selfrun
sem
semlimit
sha1_test
shortpush
shorts
sigstackgrowth
smc1
stackgrowth
susphello
syscall-restart1
syscall-restart2
syslog
system
thread-exits
threaded-fork
threadederrno
timestamp
tls
vgcore.*
vgprintf
yield
+ *.dSYM
*.so
*.stderr.diff*
*.stderr.out
*.stdout.diff*
*.stdout.out
.deps
ansi
args
async-sigs
as_mmap
as_shm
bitfield1
blockfault
bug129866
closeall
coolo_sigaction
coolo_strlen
discard
exec-sigmask
execve
faultstatus
fcntl_setown
fdleak_cmsg
fdleak_creat
fdleak_dup
fdleak_dup2
fdleak_fcntl
fdleak_ipv4
fdleak_open
fdleak_pipe
fdleak_socketpair
floored
fork
fucomip
gxx304
insn_basic
insn_basic.c
insn_cmov
insn_cmov.c
insn_fpu
insn_fpu.c
insn_mmx
insn_mmx.c
insn_mmxext
insn_mmxext.c
insn_sse
insn_sse.c
insn_sse2
insn_sse2.c
Makefile
Makefile.in
manythreads
map_unaligned
map_unmap
mq
mremap
mremap2
munmap_exe
nestedfns
pending
pluto
procfs-cmdline-exe
pth_atfork1
pth_blockedsig
pth_cancel1
pth_cancel2
pth_cvsimple
pth_detached
pth_empty
pth_exit
pth_exit2
pth_mutexspeed
pth_once
pth_rwlock
pth_semaphore1
pth_simple_mutex
pth_simple_threads
pth_specific
pth_stackalign
pth_yield
rcrl
readline1
resolv
res_search
rlimit_nofile
selfrun
sem
semlimit
sha1_test
shortpush
shorts
sigstackgrowth
smc1
stackgrowth
susphello
syscall-restart1
syscall-restart2
syslog
system
thread-exits
threaded-fork
threadederrno
timestamp
tls
valgrind_cpp_test
vgcore.*
vgprintf
yield
Modified: trunk/none/tests/Makefile.am
===================================================================
--- trunk/none/tests/Makefile.am 2009-12-21 11:29:54 UTC (rev 10969)
+++ trunk/none/tests/Makefile.am 2009-12-29 14:11:38 UTC (rev 10970)
@@ -175,6 +175,7 @@
tls \
tls.so \
tls2.so \
+ valgrind_cpp_test \
vgprintf \
coolo_sigaction \
gxx304
@@ -262,6 +263,9 @@
tls2_so_LDFLAGS = -shared
endif
+valgrind_cpp_test_SOURCES = valgrind_cpp_test.cpp
+valgrind_cpp_test_LDADD = -lstdc++
+
# C++ tests
coolo_sigaction_SOURCES = coolo_sigaction.cpp
gxx304_SOURCES = gxx304.cpp
Added: trunk/none/tests/valgrind_cpp_test.cpp
===================================================================
--- trunk/none/tests/valgrind_cpp_test.cpp (rev 0)
+++ trunk/none/tests/valgrind_cpp_test.cpp 2009-12-29 14:11:38 UTC (rev 10970)
@@ -0,0 +1,47 @@
+// Test program to verify whether the Valgrind header files compile fine
+// with a C++ compiler.
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "pub_tool_basics.h"
+#include "pub_tool_libcassert.h"
+#include "pub_tool_libcbase.h"
+#include "pub_tool_mallocfree.h"
+#include "pub_tool_libcprint.h"
+#include "pub_tool_libcfile.h"
+#include "pub_tool_libcproc.h"
+#include "pub_tool_vki.h"
+#include "pub_tool_threadstate.h"
+#include "pub_tool_errormgr.h"
+#include "pub_tool_options.h"
+#include "pub_tool_machine.h"
+#include "pub_tool_debuginfo.h"
+#include "pub_tool_seqmatch.h"
+#include "pub_tool_tooliface.h"
+#include "pub_tool_options.h"
+
+#if defined(VGO_darwin)
+int CheckSys()
+{
+ return SysRes_MACH;
+}
+#endif
+
+void CheckAssert(int x)
+{
+ tl_assert(x);
+ tl_assert2(x, "fail");
+}
+
+int main(int argc, char** argv)
+{
+ fprintf(stderr, "Compilation succeeded.\n");
+ return 0;
+}
+
+void VG_(assert_fail)(Bool isCore, const Char* expr, const Char* file,
+ Int line, const Char* fn, const HChar* format, ... )
+{
+ abort();
+}
|