From 33296cfaf4f673fa5ca21a051673fa3532966a74 Mon Sep 17 00:00:00 2001 From: gkm Date: Sun, 2 Jan 2005 22:24:50 +0000 Subject: * mf-impl.h (uintptr_t): Get typedef via stdint.h or define explicitly. * mf-runtime.h: New file, replaces mf-runtime.h.in. * configure.ac (AC_CONFIG_FILES): mf-runtime.h is no longer generated. * Makefile.in: Ditto. * testsuite/lib/libmudflap.exp: Add -I${srcdir}/.. to get mf-runtime.h * testsuite/libmudflap.c/pass32-frag.c: s/uintptr_t/__mf_uintptr_t/ * testsuite/libmudflap.c/fail36-frag.c: New test. * testsuite/libmudflap.c/fail37-frag.c: New test. * testsuite/libmudflap.c/fail38-frag.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92815 138bc75d-0d04-0410-961f-82ee72b054a4 --- libmudflap/ChangeLog | 12 ++ libmudflap/Makefile.in | 5 +- libmudflap/configure | 3 +- libmudflap/configure.ac | 2 +- libmudflap/mf-impl.h | 7 +- libmudflap/mf-runtime.h | 213 +++++++++++++++++++++++ libmudflap/mf-runtime.h.in | 221 ------------------------ libmudflap/testsuite/lib/libmudflap.exp | 2 +- libmudflap/testsuite/libmudflap.c/fail36-frag.c | 23 +++ libmudflap/testsuite/libmudflap.c/fail37-frag.c | 22 +++ libmudflap/testsuite/libmudflap.c/fail38-frag.c | 29 ++++ libmudflap/testsuite/libmudflap.c/pass32-frag.c | 2 +- 12 files changed, 310 insertions(+), 231 deletions(-) create mode 100644 libmudflap/mf-runtime.h delete mode 100644 libmudflap/mf-runtime.h.in create mode 100644 libmudflap/testsuite/libmudflap.c/fail36-frag.c create mode 100644 libmudflap/testsuite/libmudflap.c/fail37-frag.c create mode 100644 libmudflap/testsuite/libmudflap.c/fail38-frag.c (limited to 'libmudflap') diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index d2fc9ee45aa..ace95ce6062 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,3 +1,15 @@ +2004-01-02 Greg McGary + + * mf-impl.h (uintptr_t): Get typedef via stdint.h or define explicitly. + * mf-runtime.h: New file, replaces mf-runtime.h.in. + * configure.ac (AC_CONFIG_FILES): mf-runtime.h is no longer generated. + * Makefile.in: Ditto. + * testsuite/lib/libmudflap.exp: Add -I${srcdir}/.. to get mf-runtime.h + * testsuite/libmudflap.c/pass32-frag.c: s/uintptr_t/__mf_uintptr_t/ + * testsuite/libmudflap.c/fail36-frag.c: New test. + * testsuite/libmudflap.c/fail37-frag.c: New test. + * testsuite/libmudflap.c/fail38-frag.c: New test. + 2004-12-08 Kelley Cook * Makefile.am: Add ../config to ACLOCAL_AMFLAGS. diff --git a/libmudflap/Makefile.in b/libmudflap/Makefile.in index 84506f83f8b..b251f2a8ccc 100644 --- a/libmudflap/Makefile.in +++ b/libmudflap/Makefile.in @@ -46,7 +46,7 @@ DIST_COMMON = $(am__configure_deps) $(include_HEADERS) \ $(srcdir)/../ltmain.sh $(srcdir)/../missing \ $(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/mf-runtime.h.in $(top_srcdir)/configure ChangeLog + $(top_srcdir)/configure ChangeLog subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/gcc-version.m4 \ @@ -57,7 +57,6 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno configure.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = mf-runtime.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -347,8 +346,6 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 -mf-runtime.h: $(top_builddir)/config.status $(srcdir)/mf-runtime.h.in - cd $(top_builddir) && $(SHELL) ./config.status $@ install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)" diff --git a/libmudflap/configure b/libmudflap/configure index d96a46ad944..6bcb2534ef4 100755 --- a/libmudflap/configure +++ b/libmudflap/configure @@ -6854,7 +6854,7 @@ else multilib_arg= fi - ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/mfconfig.exp mf-runtime.h" + ac_config_files="$ac_config_files Makefile testsuite/Makefile testsuite/mfconfig.exp" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -7433,7 +7433,6 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "testsuite/Makefile" ) CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; "testsuite/mfconfig.exp" ) CONFIG_FILES="$CONFIG_FILES testsuite/mfconfig.exp" ;; - "mf-runtime.h" ) CONFIG_FILES="$CONFIG_FILES mf-runtime.h" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac index 794fa9bd621..6a771f6bc93 100644 --- a/libmudflap/configure.ac +++ b/libmudflap/configure.ac @@ -231,5 +231,5 @@ else multilib_arg= fi -AC_CONFIG_FILES([Makefile testsuite/Makefile testsuite/mfconfig.exp mf-runtime.h]) +AC_CONFIG_FILES([Makefile testsuite/Makefile testsuite/mfconfig.exp]) AC_OUTPUT diff --git a/libmudflap/mf-impl.h b/libmudflap/mf-impl.h index 55706c13dba..ee582ea7bce 100644 --- a/libmudflap/mf-impl.h +++ b/libmudflap/mf-impl.h @@ -1,6 +1,6 @@ /* Implementation header for mudflap runtime library. Mudflap: narrow-pointer bounds-checking by tree rewriting. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Frank Ch. Eigler and Graydon Hoare @@ -43,6 +43,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #error "Cannot build libmudflapth without pthread.h." #endif +#if HAVE_STDINT_H +#include +#else +typedef __mf_uintptr_t uintptr_t; +#endif /* Private definitions related to mf-runtime.h */ diff --git a/libmudflap/mf-runtime.h b/libmudflap/mf-runtime.h new file mode 100644 index 00000000000..b008883c43f --- /dev/null +++ b/libmudflap/mf-runtime.h @@ -0,0 +1,213 @@ +/* Public libmudflap declarations -*- C -*- */ + +#ifndef MF_RUNTIME_H +#define MF_RUNTIME_H + +typedef void *__mf_ptr_t; +typedef unsigned int __mf_uintptr_t __attribute__ ((__mode__ (__pointer__))); +typedef __SIZE_TYPE__ __mf_size_t; + +/* Global declarations used by instrumentation. When _MUDFLAP is + defined, these have been auto-declared by the compiler and we + should not declare them again (ideally we *would* declare them + again, to verify that the compiler's declarations match the + library's, but the C++ front end has no mechanism for allowing + the re-definition of a structure type). */ +#ifndef _MUDFLAP +struct __mf_cache { __mf_uintptr_t low; __mf_uintptr_t high; }; +extern struct __mf_cache __mf_lookup_cache []; +extern __mf_uintptr_t __mf_lc_mask; +extern unsigned char __mf_lc_shift; +#endif + +/* Multithreading support. */ +#ifdef _MUDFLAPTH +/* extern pthread_mutex_t __mf_biglock; */ +#define _REENTRANT +#define _THREAD_SAFE +#endif + +/* Codes to describe the type of access to check: __mf_check arg 3 */ + +#define __MF_CHECK_READ 0 +#define __MF_CHECK_WRITE 1 + + +/* Codes to describe a region of memory being registered: __mf_*register arg 3 */ + +#define __MF_TYPE_NOACCESS 0 +#define __MF_TYPE_HEAP 1 +#define __MF_TYPE_HEAP_I 2 +#define __MF_TYPE_STACK 3 +#define __MF_TYPE_STATIC 4 +#define __MF_TYPE_GUESS 5 + + +/* The public mudflap API */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern void __mf_check (void *ptr, __mf_size_t sz, int type, const char *location) + __attribute((nothrow)); +extern void __mf_register (void *ptr, __mf_size_t sz, int type, const char *name) + __attribute((nothrow)); +extern void __mf_unregister (void *ptr, __mf_size_t sz, int type) + __attribute((nothrow)); +extern unsigned __mf_watch (void *ptr, __mf_size_t sz); +extern unsigned __mf_unwatch (void *ptr, __mf_size_t sz); +extern void __mf_report (); +extern int __mf_set_options (const char *opts); + + +/* Redirect some standard library functions to libmudflap. These are + done by simple #define rather than linker wrapping, since only + instrumented modules are meant to be affected. */ + +#ifdef _MUDFLAP +#pragma redefine_extname memcpy __mfwrap_memcpy +#pragma redefine_extname memmove __mfwrap_memmove +#pragma redefine_extname memset __mfwrap_memset +#pragma redefine_extname memcmp __mfwrap_memcmp +#pragma redefine_extname memchr __mfwrap_memchr +#pragma redefine_extname memrchr __mfwrap_memrchr +#pragma redefine_extname strcpy __mfwrap_strcpy +#pragma redefine_extname strncpy __mfwrap_strncpy +#pragma redefine_extname strcat __mfwrap_strcat +#pragma redefine_extname strncat __mfwrap_strncat +#pragma redefine_extname strcmp __mfwrap_strcmp +#pragma redefine_extname strcasecmp __mfwrap_strcasecmp +#pragma redefine_extname strncmp __mfwrap_strncmp +#pragma redefine_extname strncasecmp __mfwrap_strncasecmp +#pragma redefine_extname strdup __mfwrap_strdup +#pragma redefine_extname strndup __mfwrap_strndup +#pragma redefine_extname strchr __mfwrap_strchr +#pragma redefine_extname strrchr __mfwrap_strrchr +#pragma redefine_extname strstr __mfwrap_strstr +#pragma redefine_extname memmem __mfwrap_memmem +#pragma redefine_extname strlen __mfwrap_strlen +#pragma redefine_extname strnlen __mfwrap_strnlen +#pragma redefine_extname bzero __mfwrap_bzero +#pragma redefine_extname bcopy __mfwrap_bcopy +#pragma redefine_extname bcmp __mfwrap_bcmp +#pragma redefine_extname index __mfwrap_index +#pragma redefine_extname rindex __mfwrap_rindex +#pragma redefine_extname asctime __mfwrap_asctime +#pragma redefine_extname ctime __mfwrap_ctime +#pragma redefine_extname gmtime __mfwrap_gmtime +#pragma redefine_extname localtime __mfwrap_localtime +#pragma redefine_extname time __mfwrap_time +#pragma redefine_extname strerror __mfwrap_strerror +#pragma redefine_extname fopen __mfwrap_fopen +#pragma redefine_extname fdopen __mfwrap_fdopen +#pragma redefine_extname freopen __mfwrap_freopen +#pragma redefine_extname fclose __mfwrap_fclose +#pragma redefine_extname fread __mfwrap_fread +#pragma redefine_extname fwrite __mfwrap_fwrite +#pragma redefine_extname fgetc __mfwrap_fgetc +#pragma redefine_extname fgets __mfwrap_fgets +#pragma redefine_extname getc __mfwrap_getc +#pragma redefine_extname gets __mfwrap_gets +#pragma redefine_extname ungetc __mfwrap_ungetc +#pragma redefine_extname fputc __mfwrap_fputc +#pragma redefine_extname fputs __mfwrap_fputs +#pragma redefine_extname putc __mfwrap_putc +#pragma redefine_extname puts __mfwrap_puts +#pragma redefine_extname clearerr __mfwrap_clearerr +#pragma redefine_extname feof __mfwrap_feof +#pragma redefine_extname ferror __mfwrap_ferror +#pragma redefine_extname fileno __mfwrap_fileno +#pragma redefine_extname printf __mfwrap_printf +#pragma redefine_extname fprintf __mfwrap_fprintf +#pragma redefine_extname sprintf __mfwrap_sprintf +#pragma redefine_extname snprintf __mfwrap_snprintf +#pragma redefine_extname vprintf __mfwrap_vprintf +#pragma redefine_extname vfprintf __mfwrap_vfprintf +#pragma redefine_extname vsprintf __mfwrap_vsprintf +#pragma redefine_extname vsnprintf __mfwrap_vsnprintf +#pragma redefine_extname access __mfwrap_access +#pragma redefine_extname remove __mfwrap_remove +#pragma redefine_extname fflush __mfwrap_fflush +#pragma redefine_extname fseek __mfwrap_fseek +#pragma redefine_extname ftell __mfwrap_ftell +#pragma redefine_extname rewind __mfwrap_rewind +#pragma redefine_extname fgetpos __mfwrap_fgetpos +#pragma redefine_extname fsetpos __mfwrap_fsetpos +#pragma redefine_extname stat __mfwrap_stat +#pragma redefine_extname fstat __mfwrap_fstat +#pragma redefine_extname lstat __mfwrap_lstat +#pragma redefine_extname mkfifo __mfwrap_mkfifo +#pragma redefine_extname setvbuf __mfwrap_setvbuf +#pragma redefine_extname setbuf __mfwrap_setbuf +#pragma redefine_extname setbuffer __mfwrap_setbuffer +#pragma redefine_extname setlinebuf __mfwrap_setlinebuf +#pragma redefine_extname opendir __mfwrap_opendir +#pragma redefine_extname closedir __mfwrap_closedir +#pragma redefine_extname readdir __mfwrap_readdir +#pragma redefine_extname recv __mfwrap_recv +#pragma redefine_extname recvfrom __mfwrap_recvfrom +#pragma redefine_extname recvmsg __mfwrap_recvmsg +#pragma redefine_extname send __mfwrap_send +#pragma redefine_extname sendto __mfwrap_sendto +#pragma redefine_extname sendmsg __mfwrap_sendmsg +#pragma redefine_extname setsockopt __mfwrap_setsockopt +#pragma redefine_extname getsockopt __mfwrap_getsockopt +#pragma redefine_extname accept __mfwrap_accept +#pragma redefine_extname bind __mfwrap_bind +#pragma redefine_extname connect __mfwrap_connect +#pragma redefine_extname gethostname __mfwrap_gethostname +#pragma redefine_extname sethostname __mfwrap_sethostname +#pragma redefine_extname gethostbyname __mfwrap_gethostbyname +#pragma redefine_extname wait __mfwrap_wait +#pragma redefine_extname waitpid __mfwrap_waitpid +#pragma redefine_extname popen __mfwrap_popen +#pragma redefine_extname pclose __mfwrap_pclose +#pragma redefine_extname execve __mfwrap_execve +#pragma redefine_extname execv __mfwrap_execv +#pragma redefine_extname execvp __mfwrap_execvp +#pragma redefine_extname system __mfwrap_system +#pragma redefine_extname dlopen __mfwrap_dlopen +#pragma redefine_extname dlerror __mfwrap_dlerror +#pragma redefine_extname dlsym __mfwrap_dlsym +#pragma redefine_extname dlclose __mfwrap_dlclose +#pragma redefine_extname fopen64 __mfwrap_fopen64 +#pragma redefine_extname freopen64 __mfwrap_freopen64 +#pragma redefine_extname stat64 __mfwrap_stat64 +#pragma redefine_extname fseeko64 __mfwrap_fseeko64 +#pragma redefine_extname ftello64 __mfwrap_ftello64 +#pragma redefine_extname semop __mfwrap_semop +#pragma redefine_extname semctl __mfwrap_semctl +#pragma redefine_extname shmctl __mfwrap_shmctl +#pragma redefine_extname shmat __mfwrap_shmat +#pragma redefine_extname shmdt __mfwrap_shmdt +#pragma redefine_extname __ctype_b_loc __mfwrap___ctype_b_loc +#pragma redefine_extname __ctype_toupper_loc __mfwrap___ctype_toupper_loc +#pragma redefine_extname __ctype_tolower_loc __mfwrap___ctype_tolower_loc +#pragma redefine_extname getlogin __mfwrap_getlogin +#pragma redefine_extname cuserid __mfwrap_cuserid +#pragma redefine_extname getpwnam __mfwrap_getpwnam +#pragma redefine_extname getpwuid __mfwrap_getpwuid +#pragma redefine_extname getgrnam __mfwrap_getgrnam +#pragma redefine_extname getgrgid __mfwrap_getgrgid +#pragma redefine_extname getservent __mfwrap_getservent +#pragma redefine_extname getservbyname __mfwrap_getservbyname +#pragma redefine_extname getservbyport __mfwrap_getservbyport +#pragma redefine_extname gai_strerror __mfwrap_gai_strerror +#pragma redefine_extname getmntent __mfwrap_getmntent +#pragma redefine_extname inet_ntoa __mfwrap_inet_ntoa +#pragma redefine_extname getprotoent __mfwrap_getprotoent +#pragma redefine_extname getprotobyname __mfwrap_getprotobyname +#pragma redefine_extname getprotobynumber __mfwrap_getprotobynumber + +/* Disable glibc macros. */ +#define __NO_STRING_INLINES + +#endif /* _MUDFLAP */ + + +#ifdef __cplusplus +} +#endif + +#endif /* MF_RUNTIME_H */ diff --git a/libmudflap/mf-runtime.h.in b/libmudflap/mf-runtime.h.in deleted file mode 100644 index 0f8f9e3e2b1..00000000000 --- a/libmudflap/mf-runtime.h.in +++ /dev/null @@ -1,221 +0,0 @@ -/* Public libmudflap declarations -*- C -*- */ - -#ifndef MF_RUNTIME_H -#define MF_RUNTIME_H - -#if @MF_HAVE_STDINT_H@ /* autoconf HAVE_STDINT_H */ -#include -#endif -#include -#if ! @MF_HAVE_UINTPTR_T@ -typedef unsigned long uintptr_t; -#define HAVE_UINTPTR_T 1 -/* Define this here, in case an autoconf application was run - without CFLAGS=-fmudflap but is being compiled with -fmudflap. */ -#endif - - -/* Global declarations used by instrumentation. When _MUDFLAP is - defined, these have been auto-declared by the compiler and we - should not declare them again (ideally we *would* declare them - again, to verify that the compiler's declarations match the - library's, but the C++ front end has no mechanism for allowing - the re-definition of a structure type). */ -#ifndef _MUDFLAP -struct __mf_cache { uintptr_t low; uintptr_t high; }; -extern struct __mf_cache __mf_lookup_cache []; -extern uintptr_t __mf_lc_mask; -extern unsigned char __mf_lc_shift; -#endif - -/* Multithreading support. */ -#ifdef _MUDFLAPTH -/* extern pthread_mutex_t __mf_biglock; */ -#define _REENTRANT -#define _THREAD_SAFE -#endif - -/* Codes to describe the type of access to check: __mf_check arg 3 */ - -#define __MF_CHECK_READ 0 -#define __MF_CHECK_WRITE 1 - - -/* Codes to describe a region of memory being registered: __mf_*register arg 3 */ - -#define __MF_TYPE_NOACCESS 0 -#define __MF_TYPE_HEAP 1 -#define __MF_TYPE_HEAP_I 2 -#define __MF_TYPE_STACK 3 -#define __MF_TYPE_STATIC 4 -#define __MF_TYPE_GUESS 5 - - -/* The public mudflap API */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern void __mf_check (void *ptr, size_t sz, int type, const char *location) - __attribute((nothrow)); -extern void __mf_register (void *ptr, size_t sz, int type, const char *name) - __attribute((nothrow)); -extern void __mf_unregister (void *ptr, size_t sz, int type) - __attribute((nothrow)); -extern unsigned __mf_watch (void *ptr, size_t sz); -extern unsigned __mf_unwatch (void *ptr, size_t sz); -extern void __mf_report (); -extern int __mf_set_options (const char *opts); - - -/* Redirect some standard library functions to libmudflap. These are - done by simple #define rather than linker wrapping, since only - instrumented modules are meant to be affected. */ - -#ifdef _MUDFLAP -#pragma redefine_extname memcpy __mfwrap_memcpy -#pragma redefine_extname memmove __mfwrap_memmove -#pragma redefine_extname memset __mfwrap_memset -#pragma redefine_extname memcmp __mfwrap_memcmp -#pragma redefine_extname memchr __mfwrap_memchr -#pragma redefine_extname memrchr __mfwrap_memrchr -#pragma redefine_extname strcpy __mfwrap_strcpy -#pragma redefine_extname strncpy __mfwrap_strncpy -#pragma redefine_extname strcat __mfwrap_strcat -#pragma redefine_extname strncat __mfwrap_strncat -#pragma redefine_extname strcmp __mfwrap_strcmp -#pragma redefine_extname strcasecmp __mfwrap_strcasecmp -#pragma redefine_extname strncmp __mfwrap_strncmp -#pragma redefine_extname strncasecmp __mfwrap_strncasecmp -#pragma redefine_extname strdup __mfwrap_strdup -#pragma redefine_extname strndup __mfwrap_strndup -#pragma redefine_extname strchr __mfwrap_strchr -#pragma redefine_extname strrchr __mfwrap_strrchr -#pragma redefine_extname strstr __mfwrap_strstr -#pragma redefine_extname memmem __mfwrap_memmem -#pragma redefine_extname strlen __mfwrap_strlen -#pragma redefine_extname strnlen __mfwrap_strnlen -#pragma redefine_extname bzero __mfwrap_bzero -#pragma redefine_extname bcopy __mfwrap_bcopy -#pragma redefine_extname bcmp __mfwrap_bcmp -#pragma redefine_extname index __mfwrap_index -#pragma redefine_extname rindex __mfwrap_rindex -#pragma redefine_extname asctime __mfwrap_asctime -#pragma redefine_extname ctime __mfwrap_ctime -#pragma redefine_extname gmtime __mfwrap_gmtime -#pragma redefine_extname localtime __mfwrap_localtime -#pragma redefine_extname time __mfwrap_time -#pragma redefine_extname strerror __mfwrap_strerror -#pragma redefine_extname fopen __mfwrap_fopen -#pragma redefine_extname fdopen __mfwrap_fdopen -#pragma redefine_extname freopen __mfwrap_freopen -#pragma redefine_extname fclose __mfwrap_fclose -#pragma redefine_extname fread __mfwrap_fread -#pragma redefine_extname fwrite __mfwrap_fwrite -#pragma redefine_extname fgetc __mfwrap_fgetc -#pragma redefine_extname fgets __mfwrap_fgets -#pragma redefine_extname getc __mfwrap_getc -#pragma redefine_extname gets __mfwrap_gets -#pragma redefine_extname ungetc __mfwrap_ungetc -#pragma redefine_extname fputc __mfwrap_fputc -#pragma redefine_extname fputs __mfwrap_fputs -#pragma redefine_extname putc __mfwrap_putc -#pragma redefine_extname puts __mfwrap_puts -#pragma redefine_extname clearerr __mfwrap_clearerr -#pragma redefine_extname feof __mfwrap_feof -#pragma redefine_extname ferror __mfwrap_ferror -#pragma redefine_extname fileno __mfwrap_fileno -#pragma redefine_extname printf __mfwrap_printf -#pragma redefine_extname fprintf __mfwrap_fprintf -#pragma redefine_extname sprintf __mfwrap_sprintf -#pragma redefine_extname snprintf __mfwrap_snprintf -#pragma redefine_extname vprintf __mfwrap_vprintf -#pragma redefine_extname vfprintf __mfwrap_vfprintf -#pragma redefine_extname vsprintf __mfwrap_vsprintf -#pragma redefine_extname vsnprintf __mfwrap_vsnprintf -#pragma redefine_extname access __mfwrap_access -#pragma redefine_extname remove __mfwrap_remove -#pragma redefine_extname fflush __mfwrap_fflush -#pragma redefine_extname fseek __mfwrap_fseek -#pragma redefine_extname ftell __mfwrap_ftell -#pragma redefine_extname rewind __mfwrap_rewind -#pragma redefine_extname fgetpos __mfwrap_fgetpos -#pragma redefine_extname fsetpos __mfwrap_fsetpos -#pragma redefine_extname stat __mfwrap_stat -#pragma redefine_extname fstat __mfwrap_fstat -#pragma redefine_extname lstat __mfwrap_lstat -#pragma redefine_extname mkfifo __mfwrap_mkfifo -#pragma redefine_extname setvbuf __mfwrap_setvbuf -#pragma redefine_extname setbuf __mfwrap_setbuf -#pragma redefine_extname setbuffer __mfwrap_setbuffer -#pragma redefine_extname setlinebuf __mfwrap_setlinebuf -#pragma redefine_extname opendir __mfwrap_opendir -#pragma redefine_extname closedir __mfwrap_closedir -#pragma redefine_extname readdir __mfwrap_readdir -#pragma redefine_extname recv __mfwrap_recv -#pragma redefine_extname recvfrom __mfwrap_recvfrom -#pragma redefine_extname recvmsg __mfwrap_recvmsg -#pragma redefine_extname send __mfwrap_send -#pragma redefine_extname sendto __mfwrap_sendto -#pragma redefine_extname sendmsg __mfwrap_sendmsg -#pragma redefine_extname setsockopt __mfwrap_setsockopt -#pragma redefine_extname getsockopt __mfwrap_getsockopt -#pragma redefine_extname accept __mfwrap_accept -#pragma redefine_extname bind __mfwrap_bind -#pragma redefine_extname connect __mfwrap_connect -#pragma redefine_extname gethostname __mfwrap_gethostname -#pragma redefine_extname sethostname __mfwrap_sethostname -#pragma redefine_extname gethostbyname __mfwrap_gethostbyname -#pragma redefine_extname wait __mfwrap_wait -#pragma redefine_extname waitpid __mfwrap_waitpid -#pragma redefine_extname popen __mfwrap_popen -#pragma redefine_extname pclose __mfwrap_pclose -#pragma redefine_extname execve __mfwrap_execve -#pragma redefine_extname execv __mfwrap_execv -#pragma redefine_extname execvp __mfwrap_execvp -#pragma redefine_extname system __mfwrap_system -#pragma redefine_extname dlopen __mfwrap_dlopen -#pragma redefine_extname dlerror __mfwrap_dlerror -#pragma redefine_extname dlsym __mfwrap_dlsym -#pragma redefine_extname dlclose __mfwrap_dlclose -#pragma redefine_extname fopen64 __mfwrap_fopen64 -#pragma redefine_extname freopen64 __mfwrap_freopen64 -#pragma redefine_extname stat64 __mfwrap_stat64 -#pragma redefine_extname fseeko64 __mfwrap_fseeko64 -#pragma redefine_extname ftello64 __mfwrap_ftello64 -#pragma redefine_extname semop __mfwrap_semop -#pragma redefine_extname semctl __mfwrap_semctl -#pragma redefine_extname shmctl __mfwrap_shmctl -#pragma redefine_extname shmat __mfwrap_shmat -#pragma redefine_extname shmdt __mfwrap_shmdt -#pragma redefine_extname __ctype_b_loc __mfwrap___ctype_b_loc -#pragma redefine_extname __ctype_toupper_loc __mfwrap___ctype_toupper_loc -#pragma redefine_extname __ctype_tolower_loc __mfwrap___ctype_tolower_loc -#pragma redefine_extname getlogin __mfwrap_getlogin -#pragma redefine_extname cuserid __mfwrap_cuserid -#pragma redefine_extname getpwnam __mfwrap_getpwnam -#pragma redefine_extname getpwuid __mfwrap_getpwuid -#pragma redefine_extname getgrnam __mfwrap_getgrnam -#pragma redefine_extname getgrgid __mfwrap_getgrgid -#pragma redefine_extname getservent __mfwrap_getservent -#pragma redefine_extname getservbyname __mfwrap_getservbyname -#pragma redefine_extname getservbyport __mfwrap_getservbyport -#pragma redefine_extname gai_strerror __mfwrap_gai_strerror -#pragma redefine_extname getmntent __mfwrap_getmntent -#pragma redefine_extname inet_ntoa __mfwrap_inet_ntoa -#pragma redefine_extname getprotoent __mfwrap_getprotoent -#pragma redefine_extname getprotobyname __mfwrap_getprotobyname -#pragma redefine_extname getprotobynumber __mfwrap_getprotobynumber - -/* Disable glibc macros. */ -#define __NO_STRING_INLINES - -#endif /* _MUDFLAP */ - - -#ifdef __cplusplus -} -#endif - -#endif /* MF_RUNTIME_H */ diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp index 8c604e1bc86..4b80716ebbf 100644 --- a/libmudflap/testsuite/lib/libmudflap.exp +++ b/libmudflap/testsuite/lib/libmudflap.exp @@ -83,7 +83,7 @@ proc libmudflap-init { language } { set libs "-L${blddir}/.libs" set cxxflags "-ggdb3 -DDEBUG_ASSERT" - set includes "-I${srcdir} -I.." + set includes "-I${srcdir} -I${srcdir}/.. -I.." if {$language == "c++"} { if {[file exists $cxxflags_file]} then { diff --git a/libmudflap/testsuite/libmudflap.c/fail36-frag.c b/libmudflap/testsuite/libmudflap.c/fail36-frag.c new file mode 100644 index 00000000000..af6851c1d23 --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c/fail36-frag.c @@ -0,0 +1,23 @@ +#include + +struct k +{ + int p; + struct { + int m : 31; + } q; +}; + +int +main () +{ + volatile struct k *l = malloc (sizeof (int)); /* make it only big enough for k.p */ + /* Confirm that we instrument this nested construct + BIT_FIELD_REF(COMPONENT_REF(INDIRECT_REF)). */ + l->q.m = 5; + return 0; +} +/* { dg-output "mudflap violation 1.*" } */ +/* { dg-output "Nearby object.*" } */ +/* { dg-output "mudflap object.*" } */ +/* { dg-do run { xfail *-*-* } } */ diff --git a/libmudflap/testsuite/libmudflap.c/fail37-frag.c b/libmudflap/testsuite/libmudflap.c/fail37-frag.c new file mode 100644 index 00000000000..41ce4b91e05 --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c/fail37-frag.c @@ -0,0 +1,22 @@ +typedef struct +{ + short f : 3; +} small; + +struct +{ + int i; + small s[4]; +} x; + +main () +{ + int i; + for (i = 0; i < 5; i++) + x.s[i].f = 0; + exit (0); +} +/* { dg-output "mudflap violation 1.*" } */ +/* { dg-output "Nearby object.*" } */ +/* { dg-output "mudflap object.* x.*" } */ +/* { dg-do run { xfail *-*-* } } */ diff --git a/libmudflap/testsuite/libmudflap.c/fail38-frag.c b/libmudflap/testsuite/libmudflap.c/fail38-frag.c new file mode 100644 index 00000000000..9667e213418 --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c/fail38-frag.c @@ -0,0 +1,29 @@ +#include +#include +#include +int main () +{ +struct a { + int x; + int y; + int z : 10; +}; + +struct b { + int x; + int y; +}; + +volatile struct b k; +volatile struct a *p; + +p = (struct a*) &k; + +p->z = 'q'; + +return 0; +} +/* { dg-output "mudflap violation 1.*" } */ +/* { dg-output "Nearby object 1.*" } */ +/* { dg-output "mudflap object.*.main. k.*" } */ +/* { dg-do run { xfail *-*-* } } */ diff --git a/libmudflap/testsuite/libmudflap.c/pass32-frag.c b/libmudflap/testsuite/libmudflap.c/pass32-frag.c index 83f121d4fa2..38468642328 100644 --- a/libmudflap/testsuite/libmudflap.c/pass32-frag.c +++ b/libmudflap/testsuite/libmudflap.c/pass32-frag.c @@ -13,6 +13,6 @@ int main () { struct foo k; char *n = get_z (& k); -srand ((int)(uintptr_t) n); /* use the pointer value */ +srand ((int)(__mf_uintptr_)t n); /* use the pointer value */ return 0; } -- cgit v1.2.1