|
From: Konstantin S. <kon...@gm...> - 2009-12-29 14:44:55
|
Thank you, Bart!
Two things are still wrong:
1.pub_tool_basics.h still includes config.h, but config.h is not a part of
valgrind installation
2. When I compile none/tests/valgrind_cpp_test.cpp with gcc4.4 on linux with
-m32 I get this:
g++ -Iinst/include/valgrind -I. -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1
-m32 none/tests/valgrind_cpp_test.cpp
In file included from inst/include/valgrind/pub_tool_vki.h:49,
from none/tests/valgrind_cpp_test.cpp:14:
inst/include/valgrind/vki/vki-linux.h:2154: error:
'__vki_invalid_size_argument_for_IOC' cannot appear in a constant-expression
inst/include/valgrind/vki/vki-linux.h:2157: error:
'__vki_invalid_size_argument_for_IOC' cannot appear in a constant-expression
You need this (or similar) patch to resolve this:
Index: include/vki/vki-x86-linux.h
===================================================================
--- include/vki/vki-x86-linux.h (revision 10969)
+++ include/vki/vki-x86-linux.h (working copy)
@@ -479,12 +479,11 @@
((nr) << _VKI_IOC_NRSHIFT) | \
((size) << _VKI_IOC_SIZESHIFT))
-/* provoke compile error for invalid uses of size argument */
-extern unsigned int __vki_invalid_size_argument_for_IOC;
+/* provoke compile error (div by zero) for invalid uses of size argument */
#define _VKI_IOC_TYPECHECK(t) \
- ((sizeof(t) == sizeof(t[1]) && \
- sizeof(t) < (1 << _VKI_IOC_SIZEBITS)) ? \
- sizeof(t) : __vki_invalid_size_argument_for_IOC)
+ (sizeof(t) / \
+ (sizeof(t) == sizeof(t[1]) && \
+ sizeof(t) < (1 << _VKI_IOC_SIZEBITS)))
/* used to create numbers */
#define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
--kcc
On Tue, Dec 29, 2009 at 5:11 PM, <sv...@va...> wrote:
> 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();
> +}
>
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|