Commit 9047707e authored by Jim Meyering's avatar Jim Meyering Committed by Facebook Github Bot

configure.ac: check for -Wshadow-local and -Wshadow-compatible-local

Summary:
Add a configure-time check for whether -Wshadow-local and
-Wshadow-compatible-local are supported.  If so, arrange to
define HAVE_SHADOW_LOCAL_WARNINGS.

In Portability.h, use that new symbol to choose whether
to define FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS, which
used pragmas to disable those new warnings.

Differential Revision: D4041696

fbshipit-source-id: 520ee88ae55147a13d0a045aca7d86567a8da99d
parent 8b4722fa
......@@ -167,6 +167,14 @@ constexpr bool kHasUnalignedAccess = false;
# define FOLLY_MSVC_DISABLE_WARNING(warningNumber)
#endif
#ifdef HAVE_SHADOW_LOCAL_WARNINGS
#define FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS \
FOLLY_GCC_DISABLE_WARNING(shadow-compatible-local) \
FOLLY_GCC_DISABLE_WARNING(shadow-local)
#else
#define FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS /* empty */
#endif
#if defined(__GNUC__) && !defined(__APPLE__) && !__GNUC_PREREQ(4,9)
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019
// gcc 4.8.x incorrectly placed max_align_t in the root namespace
......
......@@ -63,6 +63,23 @@ CXXFLAGS="$STD $CXXFLAGS"
# expose required -std option via pkg-config
PKG_CXXFLAGS=$STD
# See if -Wshadow-local and -Wshadow-compatible-local are supported
AC_MSG_CHECKING(
[whether -Wshadow-local and -Wshadow-compatible-local are supported])
AC_CACHE_VAL([folly_cv_cxx_shadow_local_support], [
folly_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Wshadow-local -Wshadow-compatible-local"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[folly_cv_cxx_shadow_local_support=yes],
[folly_cv_cxx_shadow_local_support=no])
CXXFLAGS="$folly_save_CXXFLAGS"])
AC_MSG_RESULT([$folly_cv_cxx_shadow_local_support])
if test "$folly_cv_cxx_shadow_local_support" = yes; then
AC_DEFINE([HAVE_SHADOW_LOCAL_WARNINGS], [1],
[Define if both -Wshadow-local and -Wshadow-compatible-local are supported.])
fi
# Checks for glog and gflags
# There are no symbols with C linkage, so we do a try-run
AC_HAVE_LIBRARY([gflags],[],[AC_MSG_ERROR(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment