aboutsummaryrefslogtreecommitdiff
path: root/libmudflap
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2004-09-07 21:52:52 +0000
committerFrank Ch. Eigler <fche@redhat.com>2004-09-07 21:52:52 +0000
commit7e0805bed78e8cf3a777586bd6d5e04591dae4ce (patch)
tree60266192b1071f716dc829f1db1f87f97112b81a /libmudflap
parentd4d8b223ae2e1210070f5eb86927de127b2c34f0 (diff)
2004-09-07 Frank Ch. Eigler <fche@redhat.com>
* configure.ac: Look for pwd.h, grp.h, netdb.h headers and functions. * mf-hooks2.c (strerror): Unregister previous string returned by previous strerror. (getlogin,cuserid,getpwnam,getpwuid,getgrnam,getgrgid): New wrappers. (getservent,getservbyname,getservbyport,gai_strerror): Ditto. * mf-runtime.h.in: Add redefine_extname pragmas for them all. * mf-runtime.c (__mf_describe_object): Clarify object life status. * testsuite/libmudflap.c/pass48-frag.c, pass49-frag.c, fail32-frag.c: New tests. * configure, config.h.in: Regenerated. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@87160 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmudflap')
-rw-r--r--libmudflap/ChangeLog13
-rw-r--r--libmudflap/config.h.in63
-rwxr-xr-xlibmudflap/configure410
-rw-r--r--libmudflap/configure.ac7
-rw-r--r--libmudflap/mf-hooks2.c171
-rw-r--r--libmudflap/mf-runtime.c6
-rw-r--r--libmudflap/mf-runtime.h.in10
-rw-r--r--libmudflap/testsuite/libmudflap.c/fail32-frag.c16
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass48-frag.c11
-rw-r--r--libmudflap/testsuite/libmudflap.c/pass49-frag.c35
10 files changed, 696 insertions, 46 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index dcd649fe6bb..2a3e16649c0 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,16 @@
+2004-09-07 Frank Ch. Eigler <fche@redhat.com>
+
+ * configure.ac: Look for pwd.h, grp.h, netdb.h headers and functions.
+ * mf-hooks2.c (strerror): Unregister previous string returned by
+ previous strerror.
+ (getlogin,cuserid,getpwnam,getpwuid,getgrnam,getgrgid): New wrappers.
+ (getservent,getservbyname,getservbyport,gai_strerror): Ditto.
+ * mf-runtime.h.in: Add redefine_extname pragmas for them all.
+ * mf-runtime.c (__mf_describe_object): Clarify object life status.
+ * testsuite/libmudflap.c/pass48-frag.c, pass49-frag.c, fail32-frag.c:
+ New tests.
+ * configure, config.h.in: Regenerated.
+
2004-08-03 Dale Johannesen <dalej@apple.com>
* mf-runtime.c: Conditionalize POSIX_SOURCE for Darwin.
diff --git a/libmudflap/config.h.in b/libmudflap/config.h.in
index 0bbec369de2..2372c226aa9 100644
--- a/libmudflap/config.h.in
+++ b/libmudflap/config.h.in
@@ -9,6 +9,12 @@
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
+/* Define to 1 if you have the `cuserid' function. */
+#undef HAVE_CUSERID
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -27,9 +33,63 @@
/* Define to 1 if you have the `ftello64' function. */
#undef HAVE_FTELLO64
+/* Define to 1 if you have the `gai_strerror' function. */
+#undef HAVE_GAI_STRERROR
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
+
+/* Define to 1 if you have the `getgrent' function. */
+#undef HAVE_GETGRENT
+
+/* Define to 1 if you have the `getgrgid' function. */
+#undef HAVE_GETGRGID
+
+/* Define to 1 if you have the `getgrgid_r' function. */
+#undef HAVE_GETGRGID_R
+
+/* Define to 1 if you have the `getgrnam' function. */
+#undef HAVE_GETGRNAM
+
+/* Define to 1 if you have the `getgrnam_r' function. */
+#undef HAVE_GETGRNAM_R
+
+/* Define to 1 if you have the `getlogin' function. */
+#undef HAVE_GETLOGIN
+
+/* Define to 1 if you have the `getlogin_r' function. */
+#undef HAVE_GETLOGIN_R
+
+/* Define to 1 if you have the `getpwent' function. */
+#undef HAVE_GETPWENT
+
+/* Define to 1 if you have the `getpwnam' function. */
+#undef HAVE_GETPWNAM
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+#undef HAVE_GETPWNAM_R
+
+/* Define to 1 if you have the `getpwuid' function. */
+#undef HAVE_GETPWUID
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#undef HAVE_GETPWUID_R
+
+/* Define to 1 if you have the `getservbyname' function. */
+#undef HAVE_GETSERVBYNAME
+
+/* Define to 1 if you have the `getservbyport' function. */
+#undef HAVE_GETSERVBYPORT
+
+/* Define to 1 if you have the `getservent' function. */
+#undef HAVE_GETSERVENT
+
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
+/* Define to 1 if you have the <grp.h> header file. */
+#undef HAVE_GRP_H
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -51,6 +111,9 @@
/* define if you have <pthread.h> */
#undef HAVE_PTHREAD_H
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
/* Define to 1 if you have the `sethostname' function. */
#undef HAVE_SETHOSTNAME
diff --git a/libmudflap/configure b/libmudflap/configure
index 2df7182e5bd..5672cad090a 100755
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -957,7 +957,7 @@ esac
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd "$ac_popdir"
+ cd $ac_popdir
done
fi
@@ -2488,7 +2488,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2546,7 +2547,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2662,7 +2664,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2716,7 +2719,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2761,7 +2765,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2805,7 +2810,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3294,7 +3300,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3367,7 +3374,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3537,7 +3545,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3582,7 +3591,9 @@ done
-for ac_header in stdint.h execinfo.h signal.h dlfcn.h dirent.h \
+
+
+for ac_header in stdint.h execinfo.h signal.h dlfcn.h dirent.h pwd.h grp.h \
netdb.h sys/ipc.h sys/sem.h sys/shm.h sys/wait.h sys/socket.h ctype.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -3616,7 +3627,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3803,7 +3815,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3908,7 +3921,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4014,7 +4028,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4118,7 +4133,330 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+for ac_func in getlogin cuserid getpwnam getpwuid getpwent getgrnam getgrgid getgrent
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+for ac_func in getlogin_r getpwnam_r getpwuid_r getgrnam_r getgrgid_r
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+for ac_func in getservent getservbyname getservbyport getaddrinfo gai_strerror
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4177,7 +4515,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4235,7 +4574,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5004,7 +5344,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5007 "configure"' > conftest.$ac_ext
+ echo '#line 5347 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5132,7 +5472,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5308,7 +5649,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5450,7 +5792,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5510,7 +5853,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5689,7 +6033,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5838,7 +6183,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6016,7 +6362,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6962,6 +7309,11 @@ esac
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -7000,12 +7352,6 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
fi;;
esac
done` || { (exit 1); exit 1; }
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac
index e53a7ac8a9d..7c7b8c76a55 100644
--- a/libmudflap/configure.ac
+++ b/libmudflap/configure.ac
@@ -59,7 +59,7 @@ AC_TRY_COMPILE([
[AC_MSG_RESULT(no)
enable_shared=no])
-AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h dirent.h \
+AC_CHECK_HEADERS(stdint.h execinfo.h signal.h dlfcn.h dirent.h pwd.h grp.h \
netdb.h sys/ipc.h sys/sem.h sys/shm.h sys/wait.h sys/socket.h ctype.h)
AC_CHECK_FUNCS(backtrace backtrace_symbols gettimeofday signal)
@@ -72,6 +72,11 @@ AC_CHECK_FUNCS(strnlen memrchr strncpy memmem sethostname)
dnl Check for glibc ctype functions
AC_CHECK_FUNCS(__ctype_b_loc __ctype_tolower_loc __ctype_toupper_loc)
+dnl Check for pwd.h / grp.h family of functions
+AC_CHECK_FUNCS(getlogin cuserid getpwnam getpwuid getpwent getgrnam getgrgid getgrent)
+AC_CHECK_FUNCS(getlogin_r getpwnam_r getpwuid_r getgrnam_r getgrgid_r)
+AC_CHECK_FUNCS(getservent getservbyname getservbyport getaddrinfo gai_strerror)
+
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>],[union semun foo;], [mf_have_semun=1], [mf_have_semun=0])
diff --git a/libmudflap/mf-hooks2.c b/libmudflap/mf-hooks2.c
index e031b43f4c9..640b78e6be8 100644
--- a/libmudflap/mf-hooks2.c
+++ b/libmudflap/mf-hooks2.c
@@ -84,7 +84,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifdef HAVE_SYS_SHM_H
#include <sys/shm.h>
#endif
-
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
#include "mf-runtime.h"
#include "mf-impl.h"
@@ -524,7 +529,6 @@ WRAPPER2(struct tm*, gmtime, const time_t *timep)
/* The following indicate if the result of the corresponding function
* should be explicitly un/registered by the wrapper
*/
-#define MF_REGISTER_strerror __MF_TYPE_STATIC
#undef MF_REGISTER_fopen
#define MF_RESULT_SIZE_fopen (sizeof (FILE))
#undef MF_REGISTER_opendir
@@ -552,17 +556,15 @@ WRAPPER2(time_t, time, time_t *timep)
WRAPPER2(char *, strerror, int errnum)
{
char *p;
- size_t n;
+ static char * last_strerror = NULL;
+
TRACE ("%s\n", __PRETTY_FUNCTION__);
p = strerror (errnum);
- if (NULL != p) {
- n = strlen (p);
- n = CLAMPADD(n, 1);
-#ifdef MF_REGISTER_strerror
- __mf_register (p, n, MF_REGISTER_strerror, "strerror result");
-#endif
- MF_VALIDATE_EXTENT (p, n, __MF_CHECK_WRITE, "strerror result");
- }
+ if (last_strerror != NULL)
+ __mf_unregister (last_strerror, 0, __MF_TYPE_STATIC);
+ if (NULL != p)
+ __mf_register (p, strlen (p) + 1, __MF_TYPE_STATIC, "strerror result");
+ last_strerror = p;
return p;
}
@@ -1722,3 +1724,150 @@ WRAPPER2(int **, __ctype_tolower_loc, void)
return ptr;
}
#endif
+
+
+/* passwd/group related functions. These register every (static) pointer value returned,
+ and rely on libmudflap's quiet toleration of duplicate static registrations. */
+
+#ifdef HAVE_GETLOGIN
+WRAPPER2(char *, getlogin, void)
+{
+ char *buf = getlogin ();
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getlogin() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_CUSERID
+WRAPPER2(char *, cuserid, char * buf)
+{
+ if (buf != NULL)
+ {
+ MF_VALIDATE_EXTENT(buf, L_cuserid, __MF_CHECK_WRITE,
+ "cuserid destination");
+ return cuserid (buf);
+ }
+ buf = cuserid (NULL);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getcuserid() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETPWNAM
+WRAPPER2(struct passwd *, getpwnam, const char *name)
+{
+ struct passwd *buf;
+ MF_VALIDATE_EXTENT(name, strlen(name)+1, __MF_CHECK_READ,
+ "getpwnam name");
+ buf = getpwnam (name);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getpw*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETPWUID
+WRAPPER2(struct passwd *, getpwuid, uid_t uid)
+{
+ struct passwd *buf;
+ buf = getpwuid (uid);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getpw*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETGRNAM
+WRAPPER2(struct group *, getgrnam, const char *name)
+{
+ struct group *buf;
+ MF_VALIDATE_EXTENT(name, strlen(name)+1, __MF_CHECK_READ,
+ "getgrnam name");
+ buf = getgrnam (name);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getgr*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETGRGID
+WRAPPER2(struct group *, getgrgid, uid_t uid)
+{
+ struct group *buf;
+ buf = getgrgid (uid);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getgr*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETSERVENT
+WRAPPER2(struct servent *, getservent, void)
+{
+ struct servent *buf;
+ buf = getservent ();
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getserv*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETSERVBYNAME
+WRAPPER2(struct servent *, getservbyname, const char *name, const char *proto)
+{
+ struct servent *buf;
+ MF_VALIDATE_EXTENT(name, strlen(name)+1, __MF_CHECK_READ,
+ "getservbyname name");
+ MF_VALIDATE_EXTENT(proto, strlen(proto)+1, __MF_CHECK_READ,
+ "getservbyname proto");
+ buf = getservbyname (name, proto);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getserv*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GETSERVBYPORT
+WRAPPER2(struct servent *, getservbyport, int port, const char *proto)
+{
+ struct servent *buf;
+ MF_VALIDATE_EXTENT(proto, strlen(proto)+1, __MF_CHECK_READ,
+ "getservbyport proto");
+ buf = getservbyport (port, proto);
+ if (buf != NULL)
+ __mf_register (buf, sizeof(*buf), __MF_TYPE_STATIC,
+ "getserv*() return");
+ return buf;
+}
+#endif
+
+
+#ifdef HAVE_GAI_STRERROR
+WRAPPER2(const char *, gai_strerror, int errcode)
+{
+ const char *buf;
+ buf = gai_strerror (errcode);
+ if (buf != NULL)
+ __mf_register ((void *) buf, strlen(buf)+1, __MF_TYPE_STATIC,
+ "gai_strerror() return");
+ return buf;
+}
+#endif
diff --git a/libmudflap/mf-runtime.c b/libmudflap/mf-runtime.c
index f374577191a..312963b017d 100644
--- a/libmudflap/mf-runtime.c
+++ b/libmudflap/mf-runtime.c
@@ -1614,7 +1614,8 @@ __mf_describe_object (__mf_object_t *obj)
if (__mf_opts.abbreviate && obj->description_epoch == epoch)
{
fprintf (stderr,
- "mudflap object %p: name=`%s'\n",
+ "mudflap %sobject %p: name=`%s'\n",
+ (obj->deallocated_p ? "dead " : ""),
(void *) obj, (obj->name ? obj->name : ""));
return;
}
@@ -1622,13 +1623,14 @@ __mf_describe_object (__mf_object_t *obj)
obj->description_epoch = epoch;
fprintf (stderr,
- "mudflap object %p: name=`%s'\n"
+ "mudflap %sobject %p: name=`%s'\n"
"bounds=[%p,%p] size=%lu area=%s check=%ur/%uw liveness=%u%s\n"
"alloc time=%lu.%06lu pc=%p"
#ifdef LIBMUDFLAPTH
" thread=%u"
#endif
"\n",
+ (obj->deallocated_p ? "dead " : ""),
(void *) obj, (obj->name ? obj->name : ""),
(void *) obj->low, (void *) obj->high,
(unsigned long) (obj->high - obj->low + 1),
diff --git a/libmudflap/mf-runtime.h.in b/libmudflap/mf-runtime.h.in
index afb04a59b7e..5630b561b25 100644
--- a/libmudflap/mf-runtime.h.in
+++ b/libmudflap/mf-runtime.h.in
@@ -187,6 +187,16 @@ extern int __mf_set_options (const char *opts);
#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
/* Disable glibc macros. */
#define __NO_STRING_INLINES
diff --git a/libmudflap/testsuite/libmudflap.c/fail32-frag.c b/libmudflap/testsuite/libmudflap.c/fail32-frag.c
new file mode 100644
index 00000000000..2a38237b678
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/fail32-frag.c
@@ -0,0 +1,16 @@
+void foo (int k)
+{
+ volatile int *b = & k;
+ b++;
+ *b = 5;
+}
+
+int main ()
+{
+ foo (5);
+ return 0;
+}
+/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "Nearby object.*" } */
+/* { dg-output "mudflap object.*k" } */
+/* { dg-do run { xfail *-*-* } } */
diff --git a/libmudflap/testsuite/libmudflap.c/pass48-frag.c b/libmudflap/testsuite/libmudflap.c/pass48-frag.c
new file mode 100644
index 00000000000..3059762a82c
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass48-frag.c
@@ -0,0 +1,11 @@
+void foo (int k)
+{
+ volatile int *b = & k;
+ *b = 5;
+}
+
+int main ()
+{
+ foo (5);
+ return 0;
+}
diff --git a/libmudflap/testsuite/libmudflap.c/pass49-frag.c b/libmudflap/testsuite/libmudflap.c/pass49-frag.c
new file mode 100644
index 00000000000..db7453079a0
--- /dev/null
+++ b/libmudflap/testsuite/libmudflap.c/pass49-frag.c
@@ -0,0 +1,35 @@
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+int foo (int a, ...)
+{
+ va_list args;
+ char *a1;
+ int a2;
+ int k;
+
+ va_start (args, a);
+ for (k = 0; k < a; k++)
+ {
+ if ((k % 2) == 0)
+ {
+ char *b = va_arg (args, char *);
+ printf ("%s", b);
+ }
+ else
+ {
+ int b = va_arg (args, int);
+ printf ("%d", b);
+ }
+ }
+ va_end (args);
+ return a;
+}
+
+int main ()
+{
+ foo (7, "hello ", 5, " ", 3, " world ", 9, "\n");
+ return 0;
+}
+/* { dg-output "hello 5 3 world 9" } */