RFR: 8161145: The min/max macros make hotspot tests fail to build with GCC 6
Kim Barrett
kim.barrett at oracle.com
Tue Jul 12 21:23:39 UTC 2016
> On Jul 12, 2016, at 2:21 PM, Andrew Hughes <gnu.andrew at redhat.com> wrote:
> The workaround that currently works for me is:
>
> diff -r b515beb3b4ad src/share/vm/utilities/globalDefinitions.hpp
> --- a/src/share/vm/utilities/globalDefinitions.hpp Thu Jul 07 18:40:53 2016 +0100
> +++ b/src/share/vm/utilities/globalDefinitions.hpp Tue Jul 12 19:13:51 2016 +0100
> @@ -1163,8 +1163,10 @@
> #undef min
> #endif
>
> +#ifndef _GLIBCXX_STDLIB_H
> #define max(a,b) Do_not_use_max_use_MAX2_instead
> #define min(a,b) Do_not_use_min_use_MIN2_instead
> +#endif
>
> // It is necessary to use templates here. Having normal overloaded
> // functions does not work because it is necessary to provide both 32-
>
>
> _GLIBCXX_STDLIB_H only exists in GCC 6. Earlier versions use stdlib.h from the
> C library. Thus this seems to provide the solution of only disabling
> those macros only on GCC >= 6 where they conflict with the functions
> max and min defined by this C++ stdlib.h wrapper (see stdlib.h changes
> in [0])
Since when does <stdlib.h> define / declare min or max? To me, that seems like a bug in this wrapper.
> $ find /usr/lib/gcc/x86_64-pc-linux-gnu -name 'stdlib.h'
> /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/tr1/stdlib.h
> /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/g++-v5/tr1/stdlib.h
> /usr/lib/gcc/x86_64-pc-linux-gnu/6.0.0-alpha20160306/include/g++-v6/stdlib.h
> /usr/lib/gcc/x86_64-pc-linux-gnu/6.0.0-alpha20160306/include/g++-v6/tr1/stdlib.h
>
> $ grep -r '_GLIBCXX_STDLIB_H' /usr/lib/gcc/x86_64-pc-linux-gnu/
> /usr/lib/gcc/x86_64-pc-linux-gnu/6.0.0-alpha20160306/include/g++-v6/stdlib.h:#ifndef _GLIBCXX_STDLIB_H
> /usr/lib/gcc/x86_64-pc-linux-gnu/6.0.0-alpha20160306/include/g++-v6/stdlib.h:#define _GLIBCXX_STDLIB_H 1
> /usr/lib/gcc/x86_64-pc-linux-gnu/6.0.0-alpha20160306/include/g++-v6/stdlib.h:#endif // _GLIBCXX_STDLIB_H
>
> [0] https://gcc.gnu.org/gcc-6/porting_to.html
> --
> Andrew :)
>
> Senior Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
>
> PGP Key: ed25519/35964222 (hkp://keys.gnupg.net)
> Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the hotspot-dev
mailing list