diff options
author | John Wehle <john@feith.com> | 2001-09-14 17:56:47 +0000 |
---|---|---|
committer | John Wehle <wehle@gcc.gnu.org> | 2001-09-14 17:56:47 +0000 |
commit | 13d7d58bb8f40e296f072f01ca92392d7511676f (patch) | |
tree | db84b321ef89a4a329e06e3caeb0c0f8ff650bb9 /gcc/tree.c | |
parent | 623fe81066f932745d250dcc395b4c0a0cf9fd86 (diff) | |
download | gcc-13d7d58bb8f40e296f072f01ca92392d7511676f.zip gcc-13d7d58bb8f40e296f072f01ca92392d7511676f.tar.gz gcc-13d7d58bb8f40e296f072f01ca92392d7511676f.tar.bz2 |
tree.c (append_random_chars): Generate the random characters in a reproducable fashion.
* tree.c (append_random_chars): Generate the random
characters in a reproducable fashion.
From-SVN: r45606
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -4533,19 +4533,21 @@ append_random_chars (template) static unsigned HOST_WIDE_INT value; unsigned HOST_WIDE_INT v; -#ifdef HAVE_GETTIMEOFDAY - struct timeval tv; -#endif + if (! value) + { + struct stat st; - template += strlen (template); + /* VALUE should be unique for each file and must + not change between compiles since this can cause + bootstrap comparison errors. */ -#ifdef HAVE_GETTIMEOFDAY - /* Get some more or less random data. */ - gettimeofday (&tv, NULL); - value += ((unsigned HOST_WIDE_INT) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid (); -#else - value += getpid (); -#endif + if (stat (main_input_filename, &st) < 0) + abort (); + + value = st.st_dev ^ st.st_ino ^ st.st_mtime; + } + + template += strlen (template); v = value; |