Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a606faa

Browse files
Issue 5553: Improved Py_LOCAL_INLINE to actually inline under compilers other than MSC
1 parent 061b14a commit a606faa

6 files changed

Lines changed: 64 additions & 5 deletions

File tree

Include/pyport.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ typedef Py_intptr_t Py_ssize_t;
266266
* should keep using static.
267267
*/
268268

269-
#undef USE_INLINE /* XXX - set via configure? */
270-
271269
#if defined(_MSC_VER)
272270
#if defined(PY_LOCAL_AGGRESSIVE)
273271
/* enable more aggressive optimization for visual studio */

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ What's New in Python 3.2 Alpha 2?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #5553: The Py_LOCAL_INLINE macro now results in inlining on
16+
most platforms. Previously, it online inlined when using Microsoft
17+
Visual C.
18+
1519
- Issue #9712: Fix tokenize on identifiers that start with non-ascii names.
1620

1721
- Issue #9688: __basicsize__ and __itemsize__ must be accessed as Py_ssize_t.

Modules/_sre.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ static char copyright[] =
6767
/* enables fast searching */
6868
#define USE_FAST_SEARCH
6969

70-
/* enables aggressive inlining (always on for Visual C) */
71-
#undef USE_INLINE
72-
7370
/* enables copy/deepcopy handling (work in progress) */
7471
#undef USE_BUILTIN_COPY
7572

configure

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ SVNVERSION
638638
ARFLAGS
639639
AR
640640
RANLIB
641+
USE_INLINE
641642
GNULD
642643
LINKCC
643644
RUNSHARED
@@ -4754,6 +4755,55 @@ esac
47544755
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNULD" >&5
47554756
$as_echo "$GNULD" >&6; }
47564757
4758+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
4759+
$as_echo_n "checking for inline... " >&6; }
4760+
if test "${ac_cv_c_inline+set}" = set; then :
4761+
$as_echo_n "(cached) " >&6
4762+
else
4763+
ac_cv_c_inline=no
4764+
for ac_kw in inline __inline__ __inline; do
4765+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4766+
/* end confdefs.h. */
4767+
#ifndef __cplusplus
4768+
typedef int foo_t;
4769+
static $ac_kw foo_t static_foo () {return 0; }
4770+
$ac_kw foo_t foo () {return 0; }
4771+
#endif
4772+
4773+
_ACEOF
4774+
if ac_fn_c_try_compile "$LINENO"; then :
4775+
ac_cv_c_inline=$ac_kw
4776+
fi
4777+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
4778+
test "$ac_cv_c_inline" != no && break
4779+
done
4780+
4781+
fi
4782+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
4783+
$as_echo "$ac_cv_c_inline" >&6; }
4784+
4785+
case $ac_cv_c_inline in
4786+
inline | yes) ;;
4787+
*)
4788+
case $ac_cv_c_inline in
4789+
no) ac_val=;;
4790+
*) ac_val=$ac_cv_c_inline;;
4791+
esac
4792+
cat >>confdefs.h <<_ACEOF
4793+
#ifndef __cplusplus
4794+
#define inline $ac_val
4795+
#endif
4796+
_ACEOF
4797+
;;
4798+
esac
4799+
4800+
if test "$ac_cv_c_inline" != no ; then
4801+
$as_echo "#define USE_INLINE 1" >>confdefs.h
4802+
4803+
4804+
fi
4805+
4806+
47574807
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-shared" >&5
47584808
$as_echo_n "checking for --enable-shared... " >&6; }
47594809
# Check whether --enable-shared was given.

configure.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,13 @@ case `"$ac_prog" -V 2>&1 < /dev/null` in
660660
esac
661661
AC_MSG_RESULT($GNULD)
662662

663+
AC_C_INLINE
664+
if test "$ac_cv_c_inline" != no ; then
665+
AC_DEFINE(USE_INLINE,1)
666+
AC_SUBST(USE_INLINE)
667+
fi
668+
669+
663670
AC_MSG_CHECKING(for --enable-shared)
664671
AC_ARG_ENABLE(shared,
665672
AS_HELP_STRING([--enable-shared], [disable/enable building shared python library]))

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,9 @@
10431043
/* Define to 0 if you don't want to use computed gotos in ceval.c. */
10441044
#undef USE_COMPUTED_GOTOS
10451045

1046+
/* Define if the compiler supports the inline keyword */
1047+
#undef USE_INLINE
1048+
10461049
/* Enable extensions on AIX 3, Interix. */
10471050
#ifndef _ALL_SOURCE
10481051
# undef _ALL_SOURCE

0 commit comments

Comments
 (0)