On 07/12/17 00:18, Bill Fischofer wrote:
> From: Brian Brooks <brian.bro...@arm.com>
> 
> The GCC 7 series introduces changes that expose ODP compilation
> issues. These include case statement fall through warnings, and
> stricter checks on potential string overflows and other semantic
> analysis.
> 
> Fixes: https://bugs.linaro.org/show_bug.cgi?id=3027
> 
> Signed-off-by: Brian Brooks <brian.bro...@arm.com>
> Reviewed-by: Ola Liljedahl <ola.liljed...@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com>
> Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
> ---
>  DEPENDENCIES                           |  5 ++--
>  configure.ac                           | 13 ++++++++++
>  platform/linux-generic/m4/configure.m4 | 44 
> ++++++++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+), 2 deletions(-)
> 
> diff --git a/DEPENDENCIES b/DEPENDENCIES
> index a5266c9e..e344826e 100644
> --- a/DEPENDENCIES
> +++ b/DEPENDENCIES
> @@ -8,13 +8,14 @@ Prerequisites for building the OpenDataPlane (ODP) API
>  
>     automake
>     autoconf
> +   autoconf-archive
>     libtool
>  
>     On Debian/Ubuntu systems:
> -   $ sudo apt-get install automake autoconf libtool
> +   $ sudo apt-get install automake autoconf autoconf-archive libtool


there was follow up patch to remove autoconf-archive dependency. Please
take it also.

Maxim.

>  
>     On CentOS/RedHat/Fedora systems:
> -   $ sudo yum install automake autoconf libtool
> +   $ sudo yum install automake autoconf autoconf-archive libtool
>  
>  3. Required libraries
>  
> diff --git a/configure.ac b/configure.ac
> index 5c7ddd04..08cc375d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -224,6 +224,19 @@ ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations 
> -Wold-style-definition -Wpointer-
>  ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual 
> -Wformat-nonliteral"
>  ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>  ODP_CFLAGS="$ODP_CFLAGS -std=c99"
> +
> +dnl Use -Werror in the checks below since Clang emits a warning instead of
> +dnl an error when it encounters an unknown warning option.
> +AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=0],
> +                      [ODP_CFLAGS="$ODP_CFLAGS -Wimplicit-fallthrough=0"],
> +                      [], [-Werror])
> +AX_CHECK_COMPILE_FLAG([-Wformat-truncation=0],
> +                      [ODP_CFLAGS="$ODP_CFLAGS -Wformat-truncation=0"],
> +                      [], [-Werror])
> +AX_CHECK_COMPILE_FLAG([-Wformat-overflow=0],
> +                      [ODP_CFLAGS="$ODP_CFLAGS -Wformat-overflow=0"],
> +                      [], [-Werror])
> +
>  # Extra flags for example to suppress certain warning types
>  ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA"
>  
> diff --git a/platform/linux-generic/m4/configure.m4 
> b/platform/linux-generic/m4/configure.m4
> index 1b1b883d..98885f5f 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -28,6 +28,50 @@ AC_LINK_IFELSE(
>      echo "Use newer version. For gcc > 4.7.0"
>      exit -1)
>  
> +dnl Check whether -latomic is needed
> +use_libatomic=no
> +
> +AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
> +AC_LINK_IFELSE(
> +  [AC_LANG_SOURCE([[
> +    static int loc;
> +    int main(void)
> +    {
> +        int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +        return 0;
> +    }
> +    ]])],
> +  [AC_MSG_RESULT(no)],
> +  [AC_MSG_RESULT(yes)
> +   AC_CHECK_LIB(
> +     [atomic], [__atomic_exchange_8],
> +     [use_libatomic=yes],
> +     [AC_MSG_FAILURE([__atomic_exchange_8 is not available])])
> +  ])
> +
> +AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic built-ins)
> +AC_LINK_IFELSE(
> +  [AC_LANG_SOURCE([[
> +    static __int128 loc;
> +    int main(void)
> +    {
> +        __int128 prev;
> +        prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
> +        return 0;
> +    }
> +    ]])],
> +  [AC_MSG_RESULT(no)],
> +  [AC_MSG_RESULT(yes)
> +   AC_CHECK_LIB(
> +     [atomic], [__atomic_exchange_16],
> +     [use_libatomic=yes],
> +     [AC_MSG_FAILURE([cannot detect support for 128-bit atomics])])
> +  ])
> +
> +if test "x$use_libatomic" = "xyes"; then
> +  AM_LDFLAGS="$AM_LDFLAGS -latomic"
> +fi
> +
>  m4_include([platform/linux-generic/m4/odp_pthread.m4])
>  m4_include([platform/linux-generic/m4/odp_openssl.m4])
>  m4_include([platform/linux-generic/m4/odp_pcap.m4])
> 

Reply via email to