mf-impl.h (uintptr_t): Get typedef via stdint.h or define explicitly.

* 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.

From-SVN: r92815
This commit is contained in:
Greg McGary 2005-01-02 22:24:50 +00:00 committed by Greg McGary
parent 97236777ce
commit 1330529e58
11 changed files with 107 additions and 28 deletions

View File

@ -1,3 +1,15 @@
2004-01-02 Greg McGary <greg@mcgary.org>
* 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 <kcook@gcc.gnu.org>
* Makefile.am: Add ../config to ACLOCAL_AMFLAGS.

View File

@ -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)"

View File

@ -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" ;;

View File

@ -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

View File

@ -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 <fche@redhat.com>
and Graydon Hoare <graydon@redhat.com>
@ -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 <stdint.h>
#else
typedef __mf_uintptr_t uintptr_t;
#endif
/* Private definitions related to mf-runtime.h */

View File

@ -3,17 +3,9 @@
#ifndef MF_RUNTIME_H
#define MF_RUNTIME_H
#if @MF_HAVE_STDINT_H@ /* autoconf HAVE_STDINT_H */
#include <stdint.h>
#endif
#include <sys/types.h>
#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
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
@ -22,9 +14,9 @@ typedef unsigned long uintptr_t;
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; };
struct __mf_cache { __mf_uintptr_t low; __mf_uintptr_t high; };
extern struct __mf_cache __mf_lookup_cache [];
extern uintptr_t __mf_lc_mask;
extern __mf_uintptr_t __mf_lc_mask;
extern unsigned char __mf_lc_shift;
#endif
@ -57,14 +49,14 @@ extern unsigned char __mf_lc_shift;
extern "C" {
#endif
extern void __mf_check (void *ptr, size_t sz, int type, const char *location)
extern void __mf_check (void *ptr, __mf_size_t sz, int type, const char *location)
__attribute((nothrow));
extern void __mf_register (void *ptr, size_t sz, int type, const char *name)
extern void __mf_register (void *ptr, __mf_size_t sz, int type, const char *name)
__attribute((nothrow));
extern void __mf_unregister (void *ptr, size_t sz, int type)
extern void __mf_unregister (void *ptr, __mf_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 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);

View File

@ -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 {

View File

@ -0,0 +1,23 @@
#include <stdlib.h>
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 *-*-* } } */

View File

@ -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 *-*-* } } */

View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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 *-*-* } } */

View File

@ -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;
}