On 28/11/2018 7:45 pm, Patrick Zhang wrote:
> When I build on the latest jdk/jdk code base with GCC 8.2 (configured sysroot as a customized path instead of default root directory of the linux system), it failed with error: "jdk.pack/share/native/common-unpack/zip.cpp:420:23: error: declaration of 'tm* gmtime_r(const time_t*, tm*)' has a different exception specifier".
>
> The root cause is the /usr/include/time.h included in src/jdk.pack/share/native/common-unpack/zip.cpp is treated as a non-system header file, so the originally suppressed error concerning "mismatched exception specifiers" gets exposed now. As the macro __THROW is defined in sys/cdefs.h we could reuse it on the condition of (defined(__GNUC__) && defined(__THROW)). Could you please help review this simple patch and comment, thanks!
>
>
> diff -r 19b15ff2576b src/jdk.pack/share/native/common-unpack/zip.cpp
>
> --- a/src/jdk.pack/share/native/common-unpack/zip.cpp Tue Nov 27 21:20:16 2018 -0500
>
> +++ b/src/jdk.pack/share/native/common-unpack/zip.cpp Wed Nov 28 04:21:07 2018 -0500
>
> @@ -417,7 +417,10 @@
>
> }
>
>
>
> #ifdef _REENTRANT // solaris
>
> -extern "C" struct tm *gmtime_r(const time_t *, struct tm *);
>
> +#if !(defined(__GNUC__) && defined(__THROW))
>
> +#define __THROW
>
> +#endif
>
> +extern "C" struct tm *gmtime_r(const time_t *, struct tm *) __THROW;
>
> #else
>
> #define gmtime_r(t, s) gmtime(t)
>
> #endif
>
> Regards
> Patrick
>