This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: out-of-line and arch-specific random_device
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: drepper at gmail dot com
- Cc: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Thu, 30 Aug 2012 17:52:51 +0200
- Subject: Re: out-of-line and arch-specific random_device
> From: Ulrich Drepper <drepper@gmail.com>
> Date: Tue, 28 Aug 2012 05:57:08 +0200
This patch (commit r190787) broke build for non-_GLIBCXX_USE_RANDOM_TR1
targets. (See libstdc++-v3/configure.ac and its crossconfig.m4 for a
list.)
> Index: libstdc++-v3/include/bits/random.h
> ===================================================================
> --- libstdc++-v3/include/bits/random.h (revision 190713)
> +++ libstdc++-v3/include/bits/random.h (working copy)
> @@ -1575,40 +1575,20 @@
> #ifdef _GLIBCXX_USE_RANDOM_TR1
>
> explicit
> - random_device(const std::string& __token = "/dev/urandom")
> + random_device(const std::string& __token = "default")
> {
> - if ((__token != "/dev/urandom" && __token != "/dev/random")
> - || !(_M_file = std::fopen(__token.c_str(), "rb")))
> - std::__throw_runtime_error(__N("random_device::"
> - "random_device(const std::string&)"));
> + _M_init(__token);
> }
>
> ~random_device()
> - { std::fclose(_M_file); }
> + { _M_fini(); }
>
> #else
>
> explicit
> random_device(const std::string& __token = "mt19937")
> - : _M_mt(_M_strtoul(__token)) { }
> + { return _M_init_pretr1(__token); }
>
make[4]: Entering directory `/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include'
mkdir -p ./cris-elf/bits/stdc++.h.gch
/tmp/hpautotest-gcc0/cris-elf/gccobj/./gcc/xgcc -shared-libgcc -B/tmp/hpautotest-gcc0/cris-elf/gccobj/./gcc -nostdinc++ -L/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/src -L/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/src/.libs -nostdinc -B/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/newlib/ -isystem /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/newlib/targ-include -isystem /tmp/hpautotest-gcc0/gcc/newlib/libc/include -B/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libgloss/cris -L/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libgloss/libnosys -L/tmp/hpautotest-gcc0/gcc/libgloss/cris -B/tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/bin/ -B/tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/lib/ -isystem /tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/include -isystem /tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/sys-include -x c++-header -nostdinc++ -g -O2 -I/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/cris-elf -I/tmp/hpautotest-gcc0/cris-elf/
gccobj/cris-elf/libstdc++-v3/include -I/tmp/hpautotest-gcc0/gcc/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /tmp/hpautotest-gcc0/gcc/libstdc++-v3/include/precompiled/stdc++.h \
-o cris-elf/bits/stdc++.h.gch/O2ggnu++0x.gch
In file included from /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/random:50:0,
from /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/bits/stl_algo.h:67,
from /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/algorithm:63,
from /tmp/hpautotest-gcc0/gcc/libstdc++-v3/include/precompiled/stdc++.h:65:
/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/bits/random.h: In constructor 'std::random_device::random_device(const string&)':
/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libstdc++-v3/include/bits/random.h:1590:36: error: returning a value from a constructor
{ return _M_init_pretr1(__token); }
^
make[4]: *** [cris-elf/bits/stdc++.h.gch/O2ggnu++0x.gch] Error 1
brgds, H-P