Skip to content

Commit 5ffe87e

Browse files
committed
Add additional CheckFunc test cases and update change notice for CheckFunc.
Changes: * add additional CheckFunc test cases to SCons/SConfTests.py * add paragraph tags around change notice for CheckFunc funcargs argument in doc/man/scons.xml
1 parent 72e3a75 commit 5ffe87e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

SCons/SConfTests.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,25 @@ def test_CheckFunc(self) -> None:
671671
log_file=self.test.workpath('config.log'))
672672

673673
try:
674-
# CheckFunc()
674+
# look for function using default heading
675675
r = sconf.CheckFunc('strcpy')
676676
assert r, "did not find strcpy"
677+
# no default heading, supply dummy signature
677678
r = sconf.CheckFunc('strcpy', '/* header */ char strcpy();')
678679
assert r, "did not find strcpy"
680+
# ... supply complete signature, and function args
679681
r = sconf.CheckFunc('strcpy', header='/* header */ char *strcpy(char *dest, char *src);', funcargs='"", ""')
682+
# ... supply standard header for prototype, and function args
683+
assert r, "did not find strcpy"
684+
r = sconf.CheckFunc('strcpy', header='#include <string.h>', funcargs='"", ""')
685+
# also try in C++ mode
686+
cpp_header = """\
687+
#ifdef __cplusplus
688+
extern "C"
689+
#endif
690+
char *strcpy(char *dest, char *src);
691+
"""
692+
r = sconf.CheckFunc('strcpy', header=cpp_header, funcargs='"", ""', language="C++")
680693
assert r, "did not find strcpy"
681694
r = sconf.CheckFunc('hopefullynofunction')
682695
assert not r, "unexpectedly found hopefullynofunction"

doc/man/scons.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,7 +3993,9 @@ Note: if <parameter>header</parameter> is supplied,
39933993
by using the <parameter>funcargs</parameter>.
39943994
</para>
39953995

3996+
<para>
39963997
<emphasis>Changed in version 4.7.0: added the <parameter>funcargs</parameter>.</emphasis>
3998+
</para>
39973999

39984000
<para>Returns a boolean indicating success or failure.</para>
39994001
</listitem>

0 commit comments

Comments
 (0)