Remove configure test for override keyword.

Detect its support in the code by testing __cplusplus value and using specific
checks for MSVC and Clang as configure detects it as being available when
using recent g++ versions in non-C++11 mode, which do support this keyword but
warn when it is used without -std={gnu,c}++11 option, which makes actually
using it a bad idea in this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-03-20 15:49:07 +00:00
parent 33ad33d447
commit 78de4fe291
5 changed files with 9 additions and 106 deletions

View File

@ -255,39 +255,6 @@ AC_DEFUN([WX_CPP_EXPLICIT],
fi
])
dnl ---------------------------------------------------------------------------
dnl WX_CPP_OVERRIDE checks whether the C++ compiler support the override
dnl keyword and defines HAVE_OVERRIDE if this is the case
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_CPP_OVERRIDE],
[
AC_CACHE_CHECK([if C++ compiler supports the override keyword],
wx_cv_override,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE(
[
struct Base { virtual void Foo() = 0; };
struct Derived : Base { virtual void Foo() override { } };
],
[
return 0;
],
wx_cv_override=yes,
wx_cv_override=no
)
AC_LANG_RESTORE
])
if test "$wx_cv_override" = "yes"; then
AC_DEFINE(HAVE_OVERRIDE)
fi
])
dnl ---------------------------------------------------------------------------
dnl WX_CHECK_FUNCS(FUNCTIONS...,
dnl [ACTION-IF-FOUND],

56
configure vendored
View File

@ -21173,62 +21173,6 @@ $as_echo "$wx_cv_explicit" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if C++ compiler supports the override keyword" >&5
$as_echo_n "checking if C++ compiler supports the override keyword... " >&6; }
if ${wx_cv_override+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
struct Base { virtual void Foo() = 0; };
struct Derived : Base { virtual void Foo() override { } };
int
main ()
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
wx_cv_override=yes
else
wx_cv_override=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_override" >&5
$as_echo "$wx_cv_override" >&6; }
if test "$wx_cv_override" = "yes"; then
$as_echo "#define HAVE_OVERRIDE 1" >>confdefs.h
fi
if test "x$SUNCXX" = xyes; then
CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS"
fi

View File

@ -1793,9 +1793,6 @@ WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
dnl check whether C++ compiler supports explicit keyword
WX_CPP_EXPLICIT
dnl check whether C++ compiler supports override keyword
WX_CPP_OVERRIDE
dnl With Sun CC, temporaries have block scope by default. This flag is needed
dnl to get the expression scope behaviour that conforms to the standard.
if test "x$SUNCXX" = xyes; then

View File

@ -269,21 +269,21 @@ typedef short int WXTYPE;
#define wxEXPLICIT
#endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */
/* check for override keyword support */
/* check for override keyword support */
#ifndef HAVE_OVERRIDE
#if defined(__VISUALC__) && (__VISUALC__ >= 1400)
/*
VC++ 8.0+ support C++/CLI's override, sealed, and abstract in native
code as a nonstandard extension, and C++/CLI's override fortunately
matches C++11's
*/
#if __cplusplus >= 201103L
/* All C++11 compilers should have it. */
#define HAVE_OVERRIDE
#elif wxCHECK_GCC_VERSION(4, 7) && __cplusplus >= 201103L
#elif wxCHECK_VISUALC_VERSION(8)
/*
VC++ 8.0+ do support override keyword but don't define __cplusplus
as indicating C++11 support, so handle this case specially.
*/
#define HAVE_OVERRIDE
#elif WX_HAS_CLANG_FEATURE(cxx_override_control)
#define HAVE_OVERRIDE
#endif
#endif /* !HAVE_OVERRIDE */
#endif /* !HAVE_OVERRIDE */
#ifdef HAVE_OVERRIDE
#define wxOVERRIDE override

View File

@ -698,11 +698,6 @@
*/
#undef HAVE_EXPLICIT
/*
* Define if your compiler supports the override keyword
*/
#undef HAVE_OVERRIDE
/*
* Define if your compiler has C99 va_copy
*/