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

Skip to content

Commit 354e0eb

Browse files
committed
Add check for (C) inline.
1 parent 523a237 commit 354e0eb

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""This module implements additional tests ala autoconf which can be useful."""
2+
3+
# We put them here since they could be easily reused outside numpy.distutils
4+
5+
def check_inline(cmd):
6+
"""Return the inline identifier (may be empty)."""
7+
cmd._check_compiler()
8+
body = """
9+
#ifndef __cplusplus
10+
static %(inline)s int static_func (void)
11+
{
12+
return 0;
13+
}
14+
%(inline)s int nostatic_func (void)
15+
{
16+
return 0;
17+
}
18+
#endif"""
19+
20+
for kw in ['inline', '__inline__', '__inline']:
21+
st = cmd.try_compile(body % {'inline': kw}, None, None)
22+
if st:
23+
return kw
24+
25+
return ''

numpy/distutils/command/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import distutils
1616
from numpy.distutils.exec_command import exec_command
1717
from numpy.distutils.mingw32ccompiler import generate_manifest
18+
from numpy.distutils.command.autodist import check_inline
1819

1920
LANG_EXT['f77'] = '.f'
2021
LANG_EXT['f90'] = '.f90'
@@ -340,6 +341,11 @@ def check_funcs_once(self, funcs,
340341
return self.try_link(body, headers, include_dirs,
341342
libraries, library_dirs)
342343

344+
def check_inline(self):
345+
"""Return the inline keyword recognized by the compiler, empty string
346+
otherwise."""
347+
return check_inline(self)
348+
343349
def get_output(self, body, headers=None, include_dirs=None,
344350
libraries=None, library_dirs=None,
345351
lang="c"):

0 commit comments

Comments
 (0)