This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa mudflap] cleanup


Hi -

Some more minor cleanup patch hunks attached:


Index: gcc/ChangeLog.tree-ssa
+2003-01-24  Frank Ch. Eigler  <fche@redhat.com>
+
+	* tree-mudflap.c (mf_varname_tree): Check for non-NULL DECL_NAME
+	before trying to cplus_demangle it.

Index: libmudflap/ChangeLog
+2003-01-24  Frank Ch. Eigler  <fche@redhat.com>
+
+	* configure.in: Build mf-runtime.h a more proper way.
+	* mf-hooks.c (strdup, strndup): Correct reentrancy logic.
+	* mf-runtime.c (verbose_violations): Turn on by default.
+	* mf-runtime.h.in: Remove some miscellaneous stuff ...
+	* mf-impl.h: ... and move it here.
+	* configure: Regenerated.


Index: gcc/tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-mudflap.c,v
retrieving revision 1.1.2.33
diff -u -p -r1.1.2.33 tree-mudflap.c
--- gcc/tree-mudflap.c	22 Jan 2003 18:20:34 -0000	1.1.2.33
+++ gcc/tree-mudflap.c	24 Jan 2003 16:47:44 -0000
@@ -306,7 +306,8 @@ mf_varname_tree (decl)
   {
     char *declname = NULL;
    
-    if (strcmp ("GNU C++", lang_hooks.name) == 0)
+    if (strcmp ("GNU C++", lang_hooks.name) == 0 &&
+	DECL_NAME (decl) != NULL)
       {
 	/* The gcc/cp decl_printable_name hook doesn't do as good a job as
 	   the libiberty demangler.  */
 2003-01-22  Frank Ch. Eigler  <fche@redhat.com>
 
 	* configure.in: Look for C++ compiler.
Index: libmudflap/configure
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/configure,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 configure
--- libmudflap/configure	22 Jan 2003 18:20:42 -0000	1.1.2.5
+++ libmudflap/configure	24 Jan 2003 16:47:45 -0000
@@ -3029,17 +3029,18 @@ EOF
 cat >> $CONFIG_STATUS <<\EOF
 test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
 
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-
 (
  echo '#ifndef __MF_RUNTIME_H'
  echo '#define __MF_RUNTIME_H'
- cat config.h
+ cat config.h | egrep 'HAVE_(STDINT|UINTPTR)'
  cat $srcdir/mf-runtime.h.in
  echo '#endif'
 ) > mf-runtime.h
+echo creating mf-runtime.h
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
Index: libmudflap/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/configure.in,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 configure.in
--- libmudflap/configure.in	22 Jan 2003 18:20:42 -0000	1.1.2.5
+++ libmudflap/configure.in	24 Jan 2003 16:47:45 -0000
@@ -38,12 +38,13 @@ else
 fi
 AC_SUBST(LIBMUDFLAP_PICFLAGS)
 
-AC_OUTPUT(Makefile)
-
+AC_OUTPUT(Makefile, [
 (
  echo '#ifndef __MF_RUNTIME_H'
  echo '#define __MF_RUNTIME_H'
- cat config.h
+ cat config.h | egrep 'HAVE_(STDINT|UINTPTR)'
  cat $srcdir/mf-runtime.h.in
  echo '#endif'
 ) > mf-runtime.h
+echo creating mf-runtime.h
+])
Index: libmudflap/mf-hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-hooks.c,v
retrieving revision 1.1.2.22
diff -u -p -r1.1.2.22 mf-hooks.c
--- libmudflap/mf-hooks.c	6 Jan 2003 16:13:58 -0000	1.1.2.22
+++ libmudflap/mf-hooks.c	24 Jan 2003 16:47:45 -0000
@@ -665,6 +665,8 @@ WRAPPER(char *, strdup, const char *s)
   CALL_REAL(memcpy, result, s, n);
   result[n] = '\0';
 
+  __mf_state = old_state;
+
   __mf_register ((uintptr_t) result, CLAMPADD(n,1), 
 		 __MF_TYPE_HEAP, "strdup region");
   __mf_state = old_state;
@@ -701,6 +703,8 @@ WRAPPER(char *, strndup, const char *s, 
   result += __mf_opts.crumple_zone;
   CALL_REAL(memcpy, result, s, n);
   result[n] = '\0';
+
+  __mf_state = old_state;
 
   __mf_register ((uintptr_t) result, CLAMPADD(n,1), 
 		 __MF_TYPE_HEAP, "strndup region");
Index: libmudflap/mf-impl.h
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-impl.h,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 mf-impl.h
--- libmudflap/mf-impl.h	8 Nov 2002 20:06:16 -0000	1.1.2.10
+++ libmudflap/mf-impl.h	24 Jan 2003 16:47:45 -0000
@@ -5,7 +5,7 @@
    Implementation header for mudflap runtime library.
    
    Mudflap: narrow-pointer bounds-checking by tree rewriting.  
-   Copyright (C) 2002 Free Software Foundation, Inc.  
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.  
    Contributed by Frank Ch. Eigler <fche@redhat.com> 
    and Graydon Hoare <graydon@redhat.com>
    
@@ -16,6 +16,28 @@
 #ifdef _MUDFLAP
 #error "Do not compile this file with -fmudflap!"
 #endif
+
+
+/* Address calculation macros.  */
+
+/* XXX: these macros should be in an __MF*-like namespace. */
+
+#define MINPTR ((uintptr_t) 0)
+#define MAXPTR (~ (uintptr_t) 0)
+
+/* Clamp the addition/subtraction of uintptr_t's to [MINPTR,MAXPTR] */
+#define CLAMPSUB(ptr,offset) ((ptr) >= (offset) ? (ptr)-(offset) : MINPTR)
+#define CLAMPADD(ptr,offset) ((ptr) <= MAXPTR-(offset) ? (ptr)+(offset) : MAXPTR)
+#define CLAMPSZ(ptr,size) ((size) ? ((ptr) <= MAXPTR-(size)+1 ? (ptr)+(size)-1 : MAXPTR) : (ptr))
+
+#define __MF_CACHE_INDEX(ptr) ((((uintptr_t) (ptr)) >> __mf_lc_shift) & __mf_lc_mask)
+#define __MF_CACHE_MISS_P(ptr,sz) ({ \
+             struct __mf_cache *elem = & __mf_lookup_cache[__MF_CACHE_INDEX((ptr))]; \
+             ((elem->low > (uintptr_t) (ptr)) ||                  \
+	      (elem->high < (CLAMPADD((uintptr_t) (ptr), (uintptr_t) CLAMPSUB(sz,1) )))); })
+/* XXX: the above should use CLAMPSZ () */
+
+
 
 /* Private functions. */ 
 
Index: libmudflap/mf-runtime.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.c,v
retrieving revision 1.1.2.23
diff -u -p -r1.1.2.23 mf-runtime.c
--- libmudflap/mf-runtime.c	6 Jan 2003 16:13:58 -0000	1.1.2.23
+++ libmudflap/mf-runtime.c	24 Jan 2003 16:47:45 -0000
@@ -95,7 +95,7 @@ __mf_set_default_options ()
   __mf_opts.adapt_cache = 1000003;
   __mf_opts.print_leaks = 0;
   __mf_opts.abbreviate = 1;
-  __mf_opts.verbose_violations = 0;
+  __mf_opts.verbose_violations = 1;
   __mf_opts.multi_threaded = 0;
   __mf_opts.free_queue_length = 4;
   __mf_opts.persistent_count = 100;
Index: libmudflap/mf-runtime.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.h.in,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 mf-runtime.h.in
--- libmudflap/mf-runtime.h.in	22 Jan 2003 18:20:42 -0000	1.1.2.5
+++ libmudflap/mf-runtime.h.in	24 Jan 2003 16:47:45 -0000
@@ -15,26 +15,12 @@ typedef unsigned long uintptr_t;
 #define HAVE_UINTPTR_T 1
 
 
-/* XXX: these macros should be in an __MF*-like namespace. */
-
-#define MINPTR ((uintptr_t) 0)
-#define MAXPTR (~ (uintptr_t) 0)
-
-/* Clamp the addition/subtraction of uintptr_t's to [MINPTR,MAXPTR] */
-#define CLAMPSUB(ptr,offset) ((ptr) >= (offset) ? (ptr)-(offset) : MINPTR)
-#define CLAMPADD(ptr,offset) ((ptr) <= MAXPTR-(offset) ? (ptr)+(offset) : MAXPTR)
-#define CLAMPSZ(ptr,size) ((size) ? ((ptr) <= MAXPTR-(size)+1 ? (ptr)+(size)-1 : MAXPTR) : (ptr))
+/* Global variables. */
 
 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;
-#define __MF_CACHE_INDEX(ptr) ((((uintptr_t) (ptr)) >> __mf_lc_shift) & __mf_lc_mask)
-#define __MF_CACHE_MISS_P(ptr,sz) ({ \
-             struct __mf_cache *elem = & __mf_lookup_cache[__MF_CACHE_INDEX((ptr))]; \
-             ((elem->low > (uintptr_t) (ptr)) ||                  \
-	      (elem->high < (CLAMPADD((uintptr_t) (ptr), (uintptr_t) CLAMPSUB(sz,1) )))); })
-/* XXX: the above should use CLAMPSZ () */
 
 
 /* Codes to describe the context in which a violation occurs. */
@@ -44,6 +30,7 @@ extern unsigned char __mf_lc_shift;
 #define __MF_VIOL_REGISTER 2
 #define __MF_VIOL_UNREGISTER 3
 #define __MF_VIOL_WATCH 4
+
 
 /* Codes to describe a region of memory being registered. */
   


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]