added wxEXPLICIT macro
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
47
acinclude.m4
47
acinclude.m4
@@ -144,6 +144,53 @@ AC_DEFUN([WX_CPP_BOOL],
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
|
||||||
|
dnl keyword and defines HAVE_EXPLICIT if this is the case
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
AC_DEFUN([WX_CPP_EXPLICIT],
|
||||||
|
[
|
||||||
|
AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
|
||||||
|
wx_cv_explicit,
|
||||||
|
[
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
|
||||||
|
dnl do the test in 2 steps: first check that the compiler knows about the
|
||||||
|
dnl explicit keyword at all and then verify that it really honours it
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
class Foo { public: explicit Foo(int) {} };
|
||||||
|
],
|
||||||
|
[
|
||||||
|
return 0;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
class Foo { public: explicit Foo(int) {} };
|
||||||
|
static void TakeFoo(const Foo& foo) { }
|
||||||
|
],
|
||||||
|
[
|
||||||
|
TakeFoo(17);
|
||||||
|
return 0;
|
||||||
|
],
|
||||||
|
wx_cv_explicit=no,
|
||||||
|
wx_cv_explicit=yes
|
||||||
|
)
|
||||||
|
],
|
||||||
|
wx_cv_explicit=no
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "$wx_cv_explicit" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_EXPLICIT)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
47
aclocal.m4
vendored
47
aclocal.m4
vendored
@@ -156,6 +156,53 @@ AC_DEFUN([WX_CPP_BOOL],
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
|
||||||
|
dnl keyword and defines HAVE_EXPLICIT if this is the case
|
||||||
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
AC_DEFUN([WX_CPP_EXPLICIT],
|
||||||
|
[
|
||||||
|
AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
|
||||||
|
wx_cv_explicit,
|
||||||
|
[
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
|
||||||
|
dnl do the test in 2 steps: first check that the compiler knows about the
|
||||||
|
dnl explicit keyword at all and then verify that it really honours it
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
class Foo { public: explicit Foo(int) {} };
|
||||||
|
],
|
||||||
|
[
|
||||||
|
return 0;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
class Foo { public: explicit Foo(int) {} };
|
||||||
|
static void TakeFoo(const Foo& foo) { }
|
||||||
|
],
|
||||||
|
[
|
||||||
|
TakeFoo(17);
|
||||||
|
return 0;
|
||||||
|
],
|
||||||
|
wx_cv_explicit=no,
|
||||||
|
wx_cv_explicit=yes
|
||||||
|
)
|
||||||
|
],
|
||||||
|
wx_cv_explicit=no
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "$wx_cv_explicit" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_EXPLICIT)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
@@ -1406,6 +1406,9 @@ WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH))
|
|||||||
dnl check whether C++ compiler supports bool built-in type
|
dnl check whether C++ compiler supports bool built-in type
|
||||||
WX_CPP_BOOL
|
WX_CPP_BOOL
|
||||||
|
|
||||||
|
dnl check whether C++ compiler supports explicit keyword
|
||||||
|
WX_CPP_EXPLICIT
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl Define search path for includes and libraries: all headers and libs will be
|
dnl Define search path for includes and libraries: all headers and libs will be
|
||||||
dnl looked for in all directories of this path
|
dnl looked for in all directories of this path
|
||||||
|
@@ -171,6 +171,7 @@ wxBase:
|
|||||||
- added static wxFontMapper::Get() accessor (use of wxTheFontMapper is now
|
- added static wxFontMapper::Get() accessor (use of wxTheFontMapper is now
|
||||||
deprecated)
|
deprecated)
|
||||||
- added wxShutdown() function (Marco Cavallini)
|
- added wxShutdown() function (Marco Cavallini)
|
||||||
|
- added wxEXPLICIT macro
|
||||||
|
|
||||||
Unix (Base/GUI):
|
Unix (Base/GUI):
|
||||||
|
|
||||||
|
@@ -67,6 +67,7 @@ the corresponding topic.
|
|||||||
\helpref{wxError}{wxerror}\\
|
\helpref{wxError}{wxerror}\\
|
||||||
\helpref{wxExecute}{wxexecute}\\
|
\helpref{wxExecute}{wxexecute}\\
|
||||||
\helpref{wxExit}{wxexit}\\
|
\helpref{wxExit}{wxexit}\\
|
||||||
|
\helpref{wxEXPLICIT}{wxexplicit}\\
|
||||||
\helpref{wxFAIL\_MSG}{wxfailmsg}\\
|
\helpref{wxFAIL\_MSG}{wxfailmsg}\\
|
||||||
\helpref{wxFAIL}{wxfail}\\
|
\helpref{wxFAIL}{wxfail}\\
|
||||||
\helpref{wxFatalError}{wxfatalerror}\\
|
\helpref{wxFatalError}{wxfatalerror}\\
|
||||||
@@ -2100,6 +2101,13 @@ The clipboard must have previously been opened for this call to succeed.
|
|||||||
|
|
||||||
\section{Miscellaneous functions}\label{miscellany}
|
\section{Miscellaneous functions}\label{miscellany}
|
||||||
|
|
||||||
|
\membersection{wxEXPLICIT}\label{wxexplicit}
|
||||||
|
|
||||||
|
{\tt wxEXPLICIT} is a macro which expands to the C++ {\tt explicit} keyword if
|
||||||
|
the compiler supports it or nothing otherwise. Thus, it can be used even in the
|
||||||
|
code which might have to be compiled with an old compiler without support for
|
||||||
|
this language feature but still take advantage of it when it is available.
|
||||||
|
|
||||||
\membersection{::wxNewId}\label{wxnewid}
|
\membersection{::wxNewId}\label{wxnewid}
|
||||||
|
|
||||||
\func{long}{wxNewId}{\void}
|
\func{long}{wxNewId}{\void}
|
||||||
|
@@ -210,7 +210,7 @@ typedef short int WXTYPE;
|
|||||||
// window id is unsigned, so we must always do the cast before comparing them
|
// window id is unsigned, so we must always do the cast before comparing them
|
||||||
// (or else they would be always different!). Usign wxGetWindowId() which does
|
// (or else they would be always different!). Usign wxGetWindowId() which does
|
||||||
// the cast itself is recommended. Note that this type can't be unsigned
|
// the cast itself is recommended. Note that this type can't be unsigned
|
||||||
// because -1 is a valid (and largely used) value for window id.
|
// because wxID_ANY == -1 is a valid (and largely used) value for window id.
|
||||||
typedef int wxWindowID;
|
typedef int wxWindowID;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -229,6 +229,20 @@ typedef int wxWindowID;
|
|||||||
#define wxUSE_NESTED_CLASSES 0
|
#define wxUSE_NESTED_CLASSES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// check for explicit keyword support
|
||||||
|
#ifndef HAVE_EXPLICIT
|
||||||
|
// TODO: add more compiler tests here
|
||||||
|
#if defined(__VISUALC__) && (__VISUALC__ > 1020)
|
||||||
|
#define HAVE_EXPLICIT
|
||||||
|
#endif
|
||||||
|
#endif // !HAVE_EXPLICIT
|
||||||
|
|
||||||
|
#ifdef HAVE_EXPLICIT
|
||||||
|
#define wxEXPLICIT explicit
|
||||||
|
#else // !HAVE_EXPLICIT
|
||||||
|
#define wxEXPLICIT
|
||||||
|
#endif // HAVE_EXPLICIT/!HAVE_EXPLICIT
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// portable calling conventions macros
|
// portable calling conventions macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -129,6 +129,11 @@
|
|||||||
*/
|
*/
|
||||||
#undef HAVE_BOOL
|
#undef HAVE_BOOL
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define if your compiler supports the explicit keyword
|
||||||
|
*/
|
||||||
|
#undef HAVE_EXPLICIT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use regex support
|
* Use regex support
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user