1.10.2 -- H5detect compile error GCC 8.1.0 on CentOS 7.2 (solved)

Hello,
I try to install HDF5 1.10.2 using GCC 8.1.0 and OpenMPI 3.1.0 (compiled with GCC 8.1.0) on a Linux CentOS 7.2 server .
The configure is done as :
./configure --prefix=/…/hdf5/openmpi/gcc81/1.10.2 --enable-fortran --enable-cxx --with-szlib=/…/hdf5/openmpi/gcc81/1.10.2 --with-zlib=/…/hdf5/openmpi/gcc81/1.10.2 --enable-parallel --enable-unsupported

The error in src/H5detect.c is :
CC H5detect.o
H5detect.c:1363:1: error: les attributs devraient être spécifiés avant le déclarateur dans une définition de fonction
static void
^~~~~~
H5detect.c:1366:58: error: expected end of line before « push »
DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++;
^
H5detect.c:1366:1: error: expected end of line before « ignored »
DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++;
^ ~~
H5detect.c:1366:1: error: expected end of line before « pop »
H5detect.c:1367:60: error: expected end of line before « push »
DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++;

The corresponding source code is

static void
detect_C89_integers(void) HDF_NO_UBSAN
{
DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++;
DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++;
DETECT_I(short, SHORT, d_g[nd_g]); nd_g++;
DETECT_I(unsigned short, USHORT, d_g[nd_g]); nd_g++;
DETECT_I(int, INT, d_g[nd_g]); nd_g++;
DETECT_I(unsigned int, UINT, d_g[nd_g]); nd_g++;
DETECT_I(long, LONG, d_g[nd_g]); nd_g++;
DETECT_I(unsigned long, ULONG, d_g[nd_g]); nd_g++;
}

Does someone get the same error ? How do you manage it ?

Regards,
Guy.

Attribute HDF_NO_UBSAN (macro) for gcc 8 needs to be before the function name. GCC 7 was okay with it.

Allen

Hi Allen,
it works, thank you for your help. So I replace
static void detect_C99_integers8(void) HDF_NO_UBSAN

by
static void HDF_NO_UBSAN detect_C99_integers8(void)

Regards,

For anyone stumbling upon this looking for a solution, here is the full one:
sed ‘s/(.*)(void) HDF_NO_UBSAN/HDF_NO_UBSAN \1(void)/’ -i src/H5detect.c